andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.83k stars 205 forks source link

restore some functions from SC #269

Open jahblah opened 6 years ago

jahblah commented 6 years ago

It appears that a lot of SC functionality has been disabled or changed. Is there a list of things that no longer work with respect to SC files?

andmarti1424 commented 6 years ago

hello. not really. have you check the doc? what commands you are having problems with?

jahblah commented 6 years ago

I've looked at the doc, but not thoroughly (forgive me). Mainly just to see how to do certain things. Example commands that don't seem to work any more are: "fkey", "tbl", "merge", and "write"; external function option renamed from "extfun" to "external_functions"; @ext() doesn't work as expected (see some of immae's posts); no -W commandline option; etc. Those are things I used extensively with SC when building external scripts, so not having them available any longer would require major changes to some sheets in order to have them work with SCIM.

jahblah commented 6 years ago

hit wrong button. oops.

andmarti1424 commented 6 years ago

Yes, some commands were removed, some renamed. do you have this defined inside .sc files: "fkey", "tbl", "merge", "write" ???? regarding external functions, I will take a look at it since theres an open issue on this one.

take note that it was added lua scripting support. please take a look at the examples to see if they can help you..

jahblah commented 6 years ago

"do you have this defined inside .sc files: "fkey", "tbl", "merge", "write" ????"

I use those commands in sc files, yes. It seems to be the only way to pass ranges to an external script. For example, the .sc file would have a line like:

fkey 3 = "merge \"|./foo.sh a0:c10 f0 /tmp/data\""

Then in foo.sh:

!/bin/bash

operation () { ret=$(whatever) # do something with the data echo ${ret} } range=${1} targetcell=${2} datafile="${3}" echo -n '' >${datafile} echo "write \"${datafile}\" ${range}" result=$(operation ${datafile}) echo "let ${targetcell} = ${ret}"

The downside is that you have to tap F3 to update the result when the data change, but I don't know of any other way to do it, since you can't pass ranges, or do back and forth communication, through @ext().

jahblah commented 6 years ago

fkey 3 = "merge \"|./foo.sh a0:c10 f0 /tmp/data\"" Escapes got lost when pasting above.

poetaman commented 3 years ago

@andmarti1424 https://github.com/n-t-roff/sc has set mouse, and claims to be a fork of the latest sc, not sure if mouse was a later addition though.

andmarti1424 commented 3 years ago

@reportaman I have included some mouse support lately. Did you check it out?

poetaman commented 3 years ago

@andmarti1424 Yes! It's not reliable though... I have a big display (27inch, 5k). There are 4 problems I see:

  1. On some terminal emulators, clicking beyond a certain column visible on screen sends clicks to that column instead of the column user clicked on. For WezTerm its column J.
  2. On some terminal emulators, clicking beyond a certain column does not do anything. For Alacritty & Kitty its column V.
  3. On all terminal emulators, after scrolling a few pages to the right, and clicking on a cell actually sends click to some column on the left most page. Ex: Clicking on BQ8, selects a cell J8 & takes the view to J8.
  4. On some terminal emulators like iTerm2 & Apple's default Terminal.app, pressing on the gutter to the right hangs sc-im, and its CPU usage remains at 100%. This happens when font size is relatively small (& column AD is visible in the opening view of sc-im), and does not happen for bigger font sizes (when column AD is not visible in opening view).

Sidenote: Vim does not have such problems (for same or even smaller font sizes), so I don't think its a terminal emulator implementation problem... (like some terms of past used to max out at 256 characters of width).

andmarti1424 commented 3 years ago

Will check point 3. 1 and 2 acting differently depending on the terminal, could be more of an ncurses issue. 4.will try to test it reducing font size in my terminal. Don't have iterm to test.

andmarti1424 commented 3 years ago

Confirmed. number 1 and 2 seems a bug in ncurses.. event.x gives wrong position! About number 3 you can update and test again. Idem about number 4. I dont have how to test it. Thanks!

poetaman commented 3 years ago

@andmarti1424 With your fix for 3, I confirm that both 3 & 4 too got fixed! So no worries if you don't have access to iTerm2.

With this fix there is no problem with Apple's Terminal & iTerm2, as 1 & 2 were not a problem with them to begin with. So Apple users can confidently use mouse with sc-im on Apple's Terminal & iTerm2. I tested by decreasing size to very small font size, and scrolling the screen to fill entire terminals with sc-im columns, and mouse works perfectly in these emulators.

It's weird that ncurses doesn't work well with other terminals. I have been gravitating towards WezTerm as it is the best of all IMO (at least nightly build with some recent fixes): it has inbuilt multiplexer that is not broken like Tmux, and is openGL based. I wonder if it is a bug with these terminals (WezTerm, Kitty, and Alacritty), and not ncurses?

andmarti1424 commented 3 years ago

@reportaman check this out. https://stackoverflow.com/questions/50851532/mouse-support-with-ncurses-for-python-for-large-terminals this is what we see here. pass 222 columns it fails.

andmarti1424 commented 3 years ago

but it fails sometimes. if i use alacritty + tmux it fails. if i use alacritty directly it doesnt. this is clearly a terminal thing.