Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text area navigation not supported? #121

Open
kgraves opened this issue Apr 9, 2015 · 5 comments
Open

text area navigation not supported? #121

kgraves opened this issue Apr 9, 2015 · 5 comments

Comments

@kgraves
Copy link

kgraves commented Apr 9, 2015

I've been playing around with blessed for a personal project, and I can't seem to get navigation in a text area working. (both when focused and in insert mode, when vi and keys are enabled) I also searched the projects issues and didn't find anyone asking about this. I feel like I may be missing something...

When I run the below example program I can not navigate in the textarea with arrow keys (while in insert mode). Also there is no cursor or indication of movement when focused, outside of insert mode. When entering insert mode, the cursor is always at the end of file/input, regardless of using vi key bindings to insert at the beginning/end of the line. (shift + i, shift + a)

I've extracted some of the code into a small example:

var blessed = require('blessed');

var screen = blessed.screen({                                                    
  autoPadding: true,                                                             
  smartCSR: true                                                                 
});

// create text area with vi keys enabled
var editor = blessed.textarea({                                                  
  parent: screen,                                                                
  border: 'line',                                                                
  style: {                                                                       
    bg: 'black',                                                                 
    fg: 'white'                                                                  
  },                                                                             
  keys: true,                                                                    
  vi: true,                                                                      
  top: 0,                                                                        
  height: '100%',                                                                
  width: '100%',                                                                 
});                                                                              
editor.focus();

// key setup                                                                     
screen.key(['escape', 'q'], function(ch, key) {                                  
  return process.exit(0);                                                        
});

screen.render();

Any ideas?

EDIT:
I forgot to add what I'm trying to accomplish. I'm trying to create a CLI note program where a user has a file explorer on the left side and a vi(m)-like editor on the right. For myself to be able to sanely edit notes, I have to be able to navigate within the editor area.

@chjj
Copy link
Owner

chjj commented Apr 9, 2015

Textarea navigation is unfortunately not yet supported. @secrettriangle, the author of the slap editor, has improved upon the blessed textarea a lot. I definitely want to get some of his improvements into blessed eventually. For now the best way to navigate text is to use normal-mode+e - the text editor mode for textareas, which opens your editor for you, allowing you to input text in vim/emacs/etc.

@secrettriangle, you have authority to experiment with new textarea features if you want. You did a whole lot better than I did for text editing. As long as these features help blessed in a general way, I'm sure they'd help slap too.

@chjj
Copy link
Owner

chjj commented Jul 16, 2015

cc @dbkaplun

@dbkaplun
Copy link
Collaborator

@kgraves is this still an issue? If so, check out editor-widget -- this is the widget that slap uses for editing. It might be a little too heavyweight for your purposes, but let us know what you come up with!

@muxa
Copy link

muxa commented Dec 13, 2017

Any updates on this feature request? Without ability to navigate in the textbox (or textarea) it becomes very difficult to edit existing values

@neauoire
Copy link

neauoire commented Apr 6, 2018

Same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants