Giter Club home page Giter Club logo

blessed's People

Contributors

anko avatar bulkan avatar chjj avatar dbkaplun avatar endangeredmassa avatar johnspackman avatar mscdex avatar naggie avatar piranna avatar yaronn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blessed's Issues

Windows support?

I've been working on a npm module https://github.com/Coalman/blessed-life and I decided to test it on windows. It seems like there are artifacts when I run it and new lines are added to the output sometimes. I was wondering if perhaps windows support is broken or if I didn't do/setup something correctly?

I've tried it in git bash/cmd and some of the examples of artifacts (the ping one). Everything works fine on linux.

this.put.cha is not a function

I'm using zsh in iterm2 on OS X.

I'm trying the included example. I haven't tried anything else and I'm not sure the right way to turn off the mouse vomiting characters feature so I just closed the tab and opened a new one.

screen shot 2013-07-17 at 4 54 45 pm

Besides this little problem I'm excited about the potential this framework has.

Form border has spaces in bottom border

I'm getting a gap in the bottom border of a form and can't see how to remove it - please can you take a look?

The code is:

var blessed = require('blessed');

var screen = blessed.screen();

var form = blessed.form({
  width: 40,
  height: 8,
  border: {
    type: "line"
  },
  keys: true
});

var cbx1 = new blessed.Checkbox({
  width: 20,
  left: 2,
  top: 1,
  text: "Check me 1"
});
form.append(cbx1);

screen.append(form);

screen.key('q', function(ch, key) {
  return process.exit(0);
});

screen.render();

Scrolling values are strange

getScroll() works in a very strange way.

After reading the documentation i would expect it to return the number of line that is currently scrolled down.
for example if i scroll one line down i expect it to return 1.
What i would expect it ti return is this:

var NrOfScrollableLines = Box.getScrollHeight() - Box.height;
Math.round(NrOfScrollableLines*(Box.getScrollPerc()/100));
//This may be a one line wrong cause of rounding so it would be better to get the value directly.

Box.alwaysScroll has to be on for this to work otherwize the terminal and blessed becomes unsynchronized.

List examples

Are there list examples ? (move up, down, enter retrieving element selected, etc)
Maybe an example can help me to understand well, thank you!

Double width characters and emojis break layout :-(

It would be 👍 if emojis and other double width characters didn't break the layouts. It seems like a simple change but I haven't found a fix yet. If you have ideas I would be happy to work on it with you.

screen.clearRegion() doesn't work

Gnome-terminal 3.12, Fedora 20

The code:
var blessed = require("blessed")
var pantalla = blessed.screen()
pantalla.key(["escape", "q", "C-c"], function() { process.exit() })
var caja=blessed.Textarea({
parent: pantalla,
keys: true, mouse: true, key:true,
top: "0%", left:"75%",
width: "25%", height: "25%",
border: { type: "line" },
style: { focus: { bg: "yellow" } },
scrollable:true,scrollbar:{fg:"white",ch:"*"}
})
caja.on("click", function() { caja.focus() })
caja.on("keypress", function(){
caja.readInput(function(datos){
caja.setContent(datos)
pantalla.render()
})
})
var ok = blessed.button({
parent: pantalla, top: "25%", left: "75%", shrink: true, mouse: true,
padding: { left: 1, right: 1 }, content: "Ok",
style: { bg: "blue", focus: { bg: "red" } }
})
var cancelar = blessed.button({
parent: pantalla, top: "25%", left: "80%", shrink: true, mouse: true,
padding: { left: 1, right: 1 }, content: "Cancelar",
style: { bg: "blue", focus: { bg: "red" } }
})
ok.on("click", function() {
ok.focus()
//I WANT TO CLEAR SCREEN TO WRITE NEW TEXT ABOVE OLD TEXT
pantalla.clearRegion(1,100,1,100)
var texto=blessed.Text({
parent:pantalla,
top:0, left: 2, fg:"white", bg:"black",
content: caja.getValue()
})
pantalla.render()
})
cancelar.on("click", function() {
cancelar.focus()
caja.clearValue()
pantalla.render()
})

Question regarding auto positioning/layout

Does blessed have an auto position feature already, i.e. I'd give it

{ top: 'auto', left: 'auto', shrink: 'flex' }

for multiple items within a screen and it would auto position them.

If this is not a blessed feature I'm looking for some feedback on how to implement this i.e. in a blessed-layout module like:

  • how do I get actual width/height of a child (in percents of the screen)
  • is there a way to suppress flicker on overlap
  • would the best way to do layout to group items or to create a grid (rows/columns)

Box border on linux console (raspberry pi) doesn't work

Hi

When running my app on the console of a Raspberry Pi, the box borders come out as

lqqqqqqqqqqqqqqqqq
x
x
mqqqqqqqqqqqqqqqq

The console does support the line drawing characters because if I set TERM=vt100 the borders are there but the colours are missing (I know that TERM should be "linux" but it illustrates that the characters are available).

Until now, I've run my app via ssh where TERM=xterm-256color and it works great.

How can I fix this?

Thanks
John

Installation: "error: there are no arguments to ‘memset’ that depend on a template parameter, so a declaration of ‘memset’ must be available [-fpermissive]"

Hi!

I'm trying to run:

npm install blessed --save

but installation doesn't happen due to following error (Ubuntu 12.10, versions of kernel, node and gyp are in the following excerpt):

> [email protected] postinstall /home/co/projects/automarket/node_modules/curses
> node-gyp rebuild --release

make: Entering directory `/home/co/projects/automarket/node_modules/curses/build'
  CXX(target) Release/obj.target/curses/src/curses.o
In file included from ../src/curses.cc:18:0:
../src/ptrwrap.h: In static member function ‘static v8::Handle<v8::Value> PtrWrap<T>::ToString(const v8::Arguments&)’:
../src/ptrwrap.h:132:22: error: there are no arguments to ‘memset’ that depend on a template parameter, so a declaration of ‘memset’ must be available [-fpermissive]
../src/ptrwrap.h:132:22: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../src/ptrwrap.h: In instantiation of ‘static v8::Handle<v8::Value> PtrWrap<T>::ToString(const v8::Arguments&) [with T = _win_st]’:
../src/ptrwrap.h:66:3:   required from ‘static v8::Persistent<v8::Function> PtrWrap<T>::Init(const char*) [with T = _win_st]’
../src/curses.cc:60:1:   required from here
../src/ptrwrap.h:132:3: error: ‘memset’ was not declared in this scope
../src/ptrwrap.h: In instantiation of ‘static v8::Handle<v8::Value> PtrWrap<T>::ToString(const v8::Arguments&) [with T = screen]’:
../src/ptrwrap.h:66:3:   required from ‘static v8::Persistent<v8::Function> PtrWrap<T>::Init(const char*) [with T = screen]’
../src/curses.cc:61:1:   required from here
../src/ptrwrap.h:132:3: error: ‘memset’ was not declared in this scope
make: *** [Release/obj.target/curses/src/curses.o] Error 1
make: Leaving directory `/home/co/projects/automarket/node_modules/curses/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.5.0-37-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /home/co/projects/automarket/node_modules/curses
gyp ERR! node -v v0.10.21
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

Could you please suggest me how to resolve this? Thanks!

How do I create buttons with focus?

Hi,

I want to be able to create a popup where the user is asked a question with OK & Cancel buttons - like the jitsu-ui screenshots (eg the createQuestion() method), except that I've tried running jitsu-ui and it has no colouring or focus indicators at all.

Is this something that's changed in jitsu-ui or is it a bug in blessed?

Thanks
John

How to scroll a ScrollableBox

Hi,

I'm using a ScrollableBox to display a list of messages and I want it to always be scrolled to the bottom of the list; at the moment, I'm using .scrollTo but that depends on knowing how many lines are on display, but this must take into account line wrapping so I can't just count the number of lines of content I've added.

What works is to call myScrollableBox.scrollTo(myScrollableBox._clines.length) but this uses a private API and I was wondering if there's an alternative?

I realise that ScrollableBox is deprecated but it has the scrollTo method and Box doesn't - and I couldn't see a way of manually scrolling a Box

Thanks
John

Stopping text input with tab or return

Hi,

I've got a demo app where the user is given a prompt window and asked to enter a text value, and because it's a single text field in a form I want to make it so that hitting tab takes the focus out of the text box and onto one of the ok/cancel buttons

At the moment, the user has to hit tab twice - it appears once to stop keyboard input and once to move to the next field.

How can I change this?

I'm using the current master and the code is based on a snippet of jitsu-ui. A gist demoing this is https://gist.github.com/johnspackman/7133517

Thanks
John

splitter?

Has anyone implemented a splitter with blessed? Something like the splitters that are in tmux that you can move around with your mouse (or keyboard) and which resizes elements on either side of it.

piping content to script incompatible with blessed

I am trying to pipe content to my script

echo "foo" | ui

Which gives me this error, when I init blessed:

/path/node_modules/blessed/lib/program.js:241
    throw new Error('Not a terminal.');
          ^
Error: Not a terminal.
    at Program.listen (/path/node_modules/blessed/lib/program.js:241:11)
    at new Program (/path/node_modules/blessed/lib/program.js:89:8)
    at Program (/path/node_modules/blessed/lib/program.js:28:12)
    at new Screen (/path/node_modules/blessed/lib/widget.js:256:20)
    at Function.Screen (/path/node_modules/blessed/lib/widget.js:245:12)
    at init (/path/includes/uilib.js:17:25)
    at initUI (/path/bin/ui:25:6)
    at Object.<anonymous> (/path/bin/ui:388:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

And that makes sense, because I use the same condition to actually check if the user piped something to my script.

I tried to disable this check in program.js which brings up these lines:

TypeError: Object #<Socket> has no method 'setRawMode'
    at Program.fn (/path/node_modules/blessed/lib/program.js:288:20)
    at Program.EventEmitter.emit (events.js:117:20)
    at Program.EventEmitter.addListener (events.js:138:10)
    at Screen._listenMouse (/path/node_modules/blessed/lib/widget.js:440:16)
    at ScrollableBox.fn (/path/node_modules/blessed/lib/widget.js:1808:19)
    at ScrollableBox.EventEmitter._emit (/path/node_modules/blessed/lib/events.js:86:20)
    at ScrollableBox.EventEmitter.addListener (/path/node_modules/blessed/lib/events.js:25:8)
    at Screen.setEffects (/path/node_modules/blessed/lib/widget.js:1602:7)
    at /path/node_modules/blessed/lib/widget.js:1849:17
    at Array.forEach (native)

Removing that line as well, lets my script run w/o errors, but blessed is not able to catch any keystrokes or mouseactions correctly. Instead it shows some controll characters on top of my UI

^[[M#?=^[[M }8^[[MC}8^[[M#}8^[[Ma?B^[[Ma?B^[[Ma?B^[[Ma?B^[[M`?B^[[M`?Bafc

I have no clue about TTYs. Is this something that can be done or is there no chance getting content from pipe and then open up an interactive UI where the user can actually interact with the content he just piped? I guess (hope!) it is possible since all user actions are actually catched but simply not interpreted correctly.

Documentation on Colors

I see the format {blue-fg}Text{/blue-fg} in a number of programs, but have been unsuccessful in getting the full range of colors/backgrounds to be used in Text elements.

What is this syntax? There is no documentation on it and no other examples I can find. Can anyone shed some light or make a colors.js example file?

My goal is to colorize different elements in a setContent() line.

How to set width/height based on character count?

I understand width/height property can be set as number(px), % etc.

Is it possible to set them based on font charcter/element count?

There is an API

foo.setLine(line_number, txt);

In that case, we control the element with line by line, and I wonder if the same can apply to window size and position.

Thanks.

Blessed causes the terminal state to go haywire

After running a blessed program, programs that are executed after blessed starts to graphically misbehave.

To replicate:

node example/index.js

Move the mouse a bit then press q. (so far so good)

vim example/index.js

Only the first 20 lines in vim is rendered sometimes the lower ones is partially rendered.
(yes i have some vim plugins, this only ocures after using blessed they can not really be blamed)

After running the flowing to reset the terminal stuff starts to work properly:
got the reset tip from ( http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-4.html )

echo -e \\033c

stty shows the same on a session that has the wired state as one that does not.

The problem seams to go away when i try using the bash shell instead of the fish shell.

Running blessed as a SU

Hi there I don't really know how to explain my issue but I made a nice script with blessed(which I love btw :P) and for personal reasons I need to run that script as a super user (su) on my VPS(Virtual private server) running ubuntu 12.

Everytime I run it as a su it doesn't work properly at all whatsoever. colors are wrong, Boxes are not actually boxes but ascii boxes?(instead of a decent border it's just dashes etc)

Is there anything I could do to fix this as I'd hate needing to drop blessed in my project.

Thanks!

Missing event propagation on Button widget

Hello,

I am having an issue that ends in a maximum stack exceeded error that has led me to that the pressed event in the Button widget is ignoring the event propagation logic:

https://github.com/chjj/blessed/blob/master/lib/widget.js#L5067-L5078

Seems to me that in line 5069 and 5075 should be changed to this:

return self.press();

And in https://github.com/chjj/blessed/blob/master/lib/widget.js#L5084-L5087

Button.prototype.press = function() {
  this.value = true;
  var result = this.emit('press');
  delete this.value;
  return result;
};

Scrolling is duplicated on each child

Example:

box A has scroll
It contains box B
box B contains box C

When you scroll one line up,
box B will move one line up And box C will move 2 lines up.

Parse tags in list items

I'm trying to format list items:

list = Blessed.list({
  items: ['{red-fg}H{/red-fg}elp']
});

But the text is rendered as literal {red-fg}H{/red-fg}elp. Is there a reason for not running each of the items through _parseTags()?

Table widget

Just a humble small feature request for a table widget, something like;

screen shot 2014-05-04 at 12 50 07 am

with a possible API of (inherits from Box);

var table = blessed.table({
  columns: ['uid', 'oid', 'tid'],
  rows: [
      [1,0,1],
      [2, 1, 1], 
      [3, 1, 1]
  ]
});

table.addRow([4, 1, 3]);

Is this a good idea ? I could work on a PR.

Unable to re-edit textboxes in insert mode

Textboxes appear to be write-once, which makes it hard to correct typos. To reproduce, start with the inclueded simple-form example and add:

blessed.textbox({
  parent: form,
  keys: true,
  left: 2,
  top: 1,
  width: 15,
  height: 1,
  style: {
    bg: "blue",
    focus: {
      bg: "red"
    }
  }
});

Then press down, enter, type some text, and press enter. At this point neither i nor enter seem to switch to insert mode, though e to edit still works (and leaves me in insert mode in the field after exiting from my editor). Am I misunderstanding the intended behavior?

how do I run example/simple-form?

Just running it with node didn't work:

$ node example/simple-form.js 

module.js:340
    throw err;
          ^
Error: Cannot find module 'blessed'
    at Function.Module._resolveFilename (module.js:338:15)

I want to help on this issue with hij1nx/lev. So I decided to pull down blessed and see if I can run the examples. I can run node example fine but I need to test an example that uses buttons (since lev is having issues with button clicks in Bash/Ubuntu).

OSX Terminal.app

Mouse input (option+) and some key presses like enter do not work under terminal.app.

Are there limitations on this or can it be considered a bug?

EventEmitter compatibility with Node mainline

I see that you've got extraneous code in events.js to extend the existing implementation. Honestly, it sketches me out just a tad that you aped the entire API from scratch to do what you want; so, I'm just opening in this issue to throw in my 👍 for the other approach. (=

Starting in single-line mode

I'm looking for a way to have blessed not clear the screen when it starts (actually I'm still puzzled as to why blessed starts up in my app even if my app takes a logical path that doesn't require anything that would require 'blessed'.) My actual goal is to be able to parse the options and just react as a normal terminal utility depending on the options, not entering curses--so any tips towards that are also appreciated.

In any case, the solution I was exploring is single-line mode, which supposedly would not clear the screen. It relies on calling the filter function from curses.h, before initscr/newterm is called. See here:

http://linux.die.net/man/3/filter

I apparently succeeded in making a call to filter, using node-ffi, but it's not making any difference. I assume it's due to the fact that filter needs to be called before initscr/newterm in order to limit LINES to 1, but by the time my app gets to main I'm guessing blessed has already started so it's too late.

Mouse events not registering past 96th block

I've trimmed this down to a single element in the terminal, that is 20 chars wide, positioned at right:0.

If I resize my terminal past 116, clicks are no longer recognized on the element.

If I I resize to 115 width, only the first character block of my element registers clicks,
if I resize to, say, 50 clicks trigger just fine anywhere on the element.

The terminal is gnome-terminal on Fedora

FileManager api Example?

Hi, this is truly a great project. I also use chjj's marks.

I see a FileManager (from List)
A very simple file manager for selecting files.
in the API list, and definitely want to implement my own based on this.

So far, I did

/* jslint node: true */
/* global describe, it, before, beforeEach, after, afterEach */

'use strict';

var blessed = require('blessed');

// Create a screen object.
var screen = blessed.screen();

// Create a box perfectly centered horizontally and vertically.
var fm = blessed.FileManager(
{
  top: 'center',
  left: 'center',
  width: '50%',
  height: '50%',
  content: 'Hello {bold}world{/bold}!',
  tags: true,
  border:
  {
    type: 'line'
  },
  style:
  {
    fg: 'white',
    bg: 'magenta',
    border:
    {
      fg: '#f0f0f0'
    },
    hover:
    {
      bg: 'green'
    }
  }
});

// Append our box to the screen.
screen.append(fm);

// If our box is clicked, change the content.
// Focus our element.
fm.focus();

// Render the screen.
screen.render();

and just see a blank box.
I would like to know how this api unit to work.
Any example or tutorial?

Thanks.

Error: EINVAL, invalid argument on cygwin

I try to run the test:

$ node test/widget.js

Error: EINVAL, invalid argument
    at new Socket (net.js:156:18)
    at process.stdin (node.js:664:19)
    at new Program (blessed\lib\program.js:41:40)
    at Program (blessed\lib\program.js:28:12)
    at new Screen (blessed\lib\widget.js:256:20)
    at Function.Screen (blessed\lib\widget.js:245:12)
    at Object.<anonymous> (blessed\test\widget.js:4:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

but it runs on CMD.exe

Removing items from a list

IDEA

What do you think about a removeItems method? This could remove a rage, for instance...

removeItems()

Remove all items.

removeItems(n)

Remove all items until n.

removeItems(Ln, Un)

Remove all items between Lower bound and Upper bound.

PROBLEM

Since there is no removeItems method, I've been looping over the items array and removing each one with removeItem, for some reason, looping forward removes only every second item! but, looping in reverse from the last one works fine, for instance...

var l = list.items.length
while(l--) {
  list.removeItem(l)
}

Program..getCursor broken in OS X's Terminal

Trying it with code similar to the following, I get the terminal's response printed to stdout, and the callback is never called:

var blessed = require('blessed')()
blessed.getCursor(function(){ console.dir(arguments) })

node v0.10.18; npm v1.3.11
Darwin Kernel Version 13.0.0: Fri Sep 13 23:35:55 PDT 2013; root:xnu-2422.1.72~1/RELEASE_X86_64

Control+Enter

Hello.
Thank's for this module. Is very cool.
But I have question.
How I can get event on keypressed Control+enter in textarea?

Incompatible with forever

I would like to use this awesome library with forever. When I run node myscript.js, everything runs perfectly. However, when I run npm install -g forever and then forever myscript.js, I get:

~/node_modules/blessed/lib/program.js:241
    throw new Error('Not a terminal.');

Error: Not a terminal.
...
error: Forever detected script exited with code: 8
error: Forever restarting script for 1 time

Thanks!

TERM=xterm should work the same as TERM=linux

Opening an GNOME Terminal, the variable TERM is set to xterm.

Running a sample app (the list), results in the borders appearing as characters instead of line. If I manually set TERM=linux, the program displays correctly.

Note that alsamixer (as an example) on the other hand behavers correctly whether TERM is set to xterm or linux.

Error install on Ubuntu 13.04

npm install blessed returns an error:

~/termcoin$ npm install blessed
npm http GET https://registry.npmjs.org/blessed
npm http 304 https://registry.npmjs.org/blessed
npm ERR! Error: ENOTDIR, mkdir '/home/scott/tmp/npm-8075-XhJVPyQY/1390185494907-0.14757413254119456'
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/isaacs/npm/issues

npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "blessed"
npm ERR! cwd /home/scott/termcoin
npm ERR! node -v v0.11.11-pre
npm ERR! npm -v 1.3.23
npm ERR! path /home/scott/tmp/npm-8075-XhJVPyQY/1390185494907-0.14757413254119456
npm ERR! code ENOTDIR
npm ERR! errno -20
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/scott/termcoin/npm-debug.log
npm ERR! not ok code 0

Clearing the menu

I am showing a menu and when they select an item from a list I want to clear the menu and console.log some information.

The reset code only gets trigger on process exit and is not exposed. I copied the code and the menu is clearing and I am able to log but there are two issues:

  1. The process stays open forever
  2. When you Ctrl-C out of the process the menu reset code from within the library gets trigger and wipes the information I logged off of the screen. There doesn't seem to be a way to disable this.

What is the best way to dispose of a screen?

RangeError: Maximum call stack size exceeded

Whenever I called hide() or remove() or toggle() on one of the forms, I get Maximum call stack size exceeded error.

I have two separate views: home and auth. Initially home is appended to screen. When I select Authentication choice from the list, I append this new auth box on top of home. But when I click Cancel button on the auth view, I would like to go back to home view. Unfortunatelly it keeps throwing this error without any explanation or stack trace.

This occurs when trying to remove the auth view:

authCancel.on('press', function() {
  screen.remove(authentication);
  screen.render();
});

Update: This is likely due to me incorrectly removing the nodes. There is not a single example in README or anywhere else on the web that I could find a usage example of .remove(node).

Update 2: I figured it out. I needed to set focus() back to my first home view when I was removing the auth layer. That was not very intuitive :/. I expected it to automatically focus on the next available node.

how I can hide all logs?

I use lame and blessed. When mp3-file is bad, lame-bakend display message. And design my app broke. Resize terminal-window using the mouse corrected it. How I can fix it not use resize?

Best way to remove an item from list widget?

Since there's no .remove method on the List widgets, what's the best way to remove an element, I've tried steamrolling it and reloading the remaining list items, however not currently even able to get that working:

  var ix = 2; //say I want to remove 2nd item
  var items = mylist.items.slice(ix, ix+1);
  mylist.items = [];
  mylist.children = [mylist[0]]; //preserve the heading label
  mylist.content = '';//for good measure...

  items.forEach(function (item) { mylist.add(item); })

This does indeed remove the items, but position and selection is all off (probably because of an internal index?)

tput stack language binary operator parameters are all backward.

Here's a snippet from the ncurses source code (ncurses/tinfo/lib_tparm.c):

            case '<':
                y = npop();
                x = npop();
                npush(x < y);
                break;

compared to blessed:

    if (read(/^%([+\-*\/m&|\^=><])/)) {
      if (ch === '=') ch = '===';
      else if (ch === 'm') ch = '%';
      expr('(stack.push(v = (stack.pop() ' + ch + ' stack.pop()) || 0), v)');
      continue;
    }

Blessed is effectively doing "y < x" which is incorrect. The case is the same for "/", "-", "m" and ">" (basically all the non-commutative ones).

I went to fix it but realized it would need temp variables and that would be ugly/impossible since it needs to be an expression. So I'll let you think about it :-).

BTW, The terminfo man page says:

   %+ %- %* %/ %m
        arithmetic (%m is mod): push(pop() op pop())

which is just downright incorrect/misleading. :-(

-David

Screen's keyable array not updated on element insertion

I ran into a hard to debug issue where an element would not receive keypress events even though it should. It turned out the problem was that I was both specifying the the screen as the element parent in its options and also later appending it to the screen.

The append first removes the element, which removes if from the screen's keyable array. However, it is not added back into the keyable array when it is reinserted, event though it is flagged as a keyable object.

The keyable array seems to serve as a flag, and as a keeper of the focus order. But there is also a keyable flag on the elements, but that cannot really be relied upon, since it may be true even if the element is not in the keyable array. This is error-prone.

I can code up a fix for this if desired, but I wanted some input. I'm not sure that simply inspecting an object's keyable property when it is inserted and adding it back into the keyable array is the right fix. Particularly since the keyable array also seems to be the keeper of the tab-order. To me it would seem better if the tab order were specified by the elements themselves.

Another option might be to just drop the check for membership in the keyable array in Screen._listenKeys. If the element is focused, then just send it key events if the element's keyable property is true and its attached. Or course this means it won't be in the tab order, however.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.