bugGNU nano - Bugs: bug #55315, [Request] display a guiding margin...


You are not allowed to post comments on this tracker with your current authentication level.

bug #55315: [Request] display a guiding margin line on the right

Submitted by:  Bryan Christ <tragicwarrior>
Submitted on:  Fri 28 Dec 2018 06:21:33 PM UTC  
Severity:  1 - Wish Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Closed

( Jump to the original submission)

Mon 25 Mar 2019 01:31:28 PM UTC, comment #25: 

The --guidestripe option has been released in version 4.0.  Thanks for the request.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sat 09 Mar 2019 08:39:45 AM UTC, comment #24: 

The option was renamed to --guidestripe, to more clearly express what it is meant to do.  And the default color is always reverse video, also when --bold is used, to avoid having an invisible stripe.

With those changes, the patch set was pushed to master, commit 66c6eb51 and the three subsequent ones.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 03 Mar 2019 02:03:31 PM UTC, comment #23: 

Attached is a proposed patch set, that will be applied to master if no further issues arise.  See also http://lists.gnu.org/archive/html/nano-devel/2019-03/msg00001.html.

(file #46396, file #46397, file #46398, file #46399)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Wed 20 Feb 2019 04:30:50 PM UTC, comment #22: 

Hmm.  I was under the impression that I had already sent this patch to the devel list, to draw comments.  But apparently this isn't the case.  :|  Have done so just now.

Updated patch is attached, as the -e option has meanwhile been taken.  The only free single letters are -J and -q, and the -q I'd like to reserve for --quiet, to make nano less chatty one day.  I couldn't think of any word that starts with "j" that has the meaning of "edge" or "brink" or "limit", so the long option has stayed --edgecolumn for now.

(Getting this into the next release is not a priority, though.  But... if more people say that they want this feature...)

(file #46315)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Wed 20 Feb 2019 01:45:49 PM UTC, comment #21: 

Any chance this will go into master soon?

Bryan Christ <tragicwarrior>
Sat 19 Jan 2019 02:03:58 PM UTC, comment #20: 

Sorry.  I don't use patch very often.  Must have overlooked that.  All is working correctly now with argv params and the entry in nanorc.  Also tested with line numbering on and off.  Looks good!

Bryan Christ <tragicwarrior>
Sat 19 Jan 2019 10:23:38 AM UTC, comment #19: 

Hm.  Forgot to attach the patch.  Now then.

(file #46028)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sat 19 Jan 2019 09:37:36 AM UTC, comment #18: 

Oh.  The patch is against git, and you are patching 3.2.  You missed the message that the first hunk for src/rcfile.c FAILED.

Attached is a backported version of the patch -- fuzz is fine, offset is fine, but FAIL is wrong.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 18 Jan 2019 08:24:26 PM UTC, comment #17: 

Using 'set edgecolumn 80' in the rc file does not work.  If I invoke with -e 80 or --edgecolumn 80 it works.  Leaving the 'set edgecolumn 80" in my rc file cause nano to display an error message every time it starts saying:

Mistakes in '/usr/local/etc/nanorc'

Bryan Christ <tragicwarrior>
Fri 18 Jan 2019 05:19:56 PM UTC, comment #16: 

Okay.  I will test all permutations of invoking this respond in the next day or so.

Regarding the margin, if I create a patch that implements ACS_VLINE without the artifacts, would that be accepted?

Bryan Christ <tragicwarrior>
Wed 16 Jan 2019 05:14:00 PM UTC, comment #15: 

Well, I'm waiting for confirmation that 'set edgecolumn 80' does work.  Yes, it will be shown red, because the nanorc syntax hasn't been adapted yet, but that doesn't mean that it doesn't work.  It should work.  When not, are you spelling it right?  If -e80 and --edge=80 work, then 'set edgecolumn 80' should work too.  Try with a different number too, to make sure.

Your motivation may be to not exceed the line, but the feature should be generally usable.  I would use it to indicate a desired maximum width, while it would be fine to exceed it by a few characters.  And the line should be visible also when all text crosses the it.  Working with either the A_ALTCHARSET or a background color (depending on whether the text stays within or exceeds the line) makes for a messy appearance, in my opinion, when some rows cross the line.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 11 Jan 2019 08:14:30 PM UTC, comment #14: 

Anything new on this?

Bryan Christ <tragicwarrior>
Wed 02 Jan 2019 07:45:47 PM UTC, comment #13: 

Also, I should have mentioned in the prev comment that --edge 80 does work now.

Bryan Christ <tragicwarrior>
Wed 02 Jan 2019 07:12:11 PM UTC, comment #12: 

I noticed that too.  The motivation for this request was to make sure no lines of code exceed the 80 column boundary.  So I've been running the hacked version and fixed those lines so I don't really see the mutilated characters.  I think the solution would be simple though.  Just add a conditional so that if the text of the line is > edgecolumn then don'te enable A_ALTCHARSET use a space instead of a 'x" as your edge_char knowing that the text will "write across".

I do remember typing edgecolumn in nanorc and it turned red when I did so indicating that it wasn't recognized.  But other values I changed in the config file did affect the behavior so I know the file is being read.  Now, I'm using the global config (/usr/local/etc/nanorc not the user level config (.nanorc).  Maybe there's a difference there?

Bryan Christ <tragicwarrior>
Wed 02 Jan 2019 06:30:37 PM UTC, comment #11: 

Using "x" and A_ALTCHARSET looks good in an empty buffer.  But try 'src/nano --edge=65 NEWS' -- it looks horrible: several letters get changed to line-drawing characters.  In other words: the text gets mutilated.  That's why I chose to use a background color: it doesn't interfere with the text.

(But maybe you are seeing something else?  What is your locale?)

Regarding 'set edgecolumn 80', it works fine here.  Try doing 'set foo' in your nanorc, and see if nano complains about an error.  If not, your nanorc is not being read.  If it is read, try using --edge=80, to check you're running the right nano.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 01 Jan 2019 09:22:57 PM UTC, comment #10: 

Also, I tested the latest patch by setting the following in nanorc and it did not have the expected effect... i still had to use -e80

set edgecolumn 80

Bryan Christ <tragicwarrior>
Tue 01 Jan 2019 09:09:09 PM UTC, comment #9: 

I took a real quick stab at it and this worked (minus the coloring because I'd had to code more to find a suitable color pair.

const char *text = converted +  actual_x(converted, edge_col - 1);;
const char edge_char = (text == '\0') ? "x" : text;

wattron(edit, A_ALTCHARSET);
mvwaddnstr(edit, row, margin + edge_col - 1, edge_char, 1);
wattroff(edit, A_ALTCHARSET);

Bryan Christ <tragicwarrior>
Tue 01 Jan 2019 04:44:44 PM UTC, comment #8: 

1. I'm coding a bit blind here in the example below, but take a look a man waddch and you should info on ACS_VLINE.
2. It shouldn't, but I've never looked at nano code.  I'm looking at your patch and since you're using curses you should be able to simply change the relevant code to something like:

const char edge_char = (text == '\0') ? "|" : text;

wattron(edit, interface_color_pair[ERROR_MESSAGE]);
wattron(edit, A_ALTCHARSET);
mvwaddnstr(edit, row, margin + edge_col, edge_char, 1);
wattron(edit, A_ALTCHARSET);
wattroff(edit, interface_color_pair[ERROR_MESSAGE] );

Technically should should be able to OR A_ALTCHARSET with interface_color_pair in your calls to wattron() and wattroff() but I've seen some issues with that from time to time.

Bryan Christ <tragicwarrior>
Tue 01 Jan 2019 03:56:12 PM UTC, comment #7: 

Attached is a version of the patch with a working --edge option, plus a "set edgecolumn" nanorc option, plus removal of a debugging leftover, plus it fixes an off-by-one error: humans (and nano) call the leftmost column 1, not 0.

ad 1)  What is ACS_VLINE?
ad 2)  Would take much more code.
ad 3)  Too neat.  :)  It doesn't fit well with nano's otherwise pretty coarse appearance.

(file #45827)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 01 Jan 2019 03:37:01 PM UTC, comment #6: 

Okay.  Using -eXX worked.  Excellent!  I turned on line numbering as well just to make sure that didn't eat into the usable space.  Well done!

A couple of thoughts here.

1.  Something like ACS_VLINE might look better.
2.  Make the line go down the entire edge of the screen no matter how many rows of content are used.

However, the margin going down the screen only as far as the bottom of the row count does serve a nice purpose.  I think it would be really neat to somewhat combine #1 and #2.

3.  Have an ACS_VLINE (or the Unicode equivalent) down the right hand margin (in white).  As the editor adds more rows, turn that portion of the vertical line red.

As a developer myself, I know that sometimes feedback can be thought of as saying "this isn't good enough".  I'm definitely not saying that here.  This is a great improvement in and and of itself.  Thanks!

Bryan Christ <tragicwarrior>
Tue 01 Jan 2019 09:42:34 AM UTC, comment #5: 

Ah, sorry.  Please use the short form for testing: -e80 or -e64 or something.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 01 Jan 2019 12:47:06 AM UTC, comment #4: 

Doesn't seem to work.  Patch went okay, but invoking with the --edge argument doesn't seem to work.

patching file src/global.c
patching file src/nano.c
Hunk #2 succeeded at 2027 (offset 1 line).
Hunk #3 succeeded at 2090 (offset 1 line).
Hunk #4 succeeded at 2209 (offset 1 line).
Hunk #5 succeeded at 2312 with fuzz 1 (offset 5 lines).
patching file src/proto.h
patching file src/winio.c
Hunk #1 succeeded at 2688 (offset 11 lines).

bryanc@p7510:~/Downloads/nano-3.2/src$ ./nano --edge=80
./nano: option '--edgecolumn' doesn't allow an argument
Type './nano -h' for a list of available options.

Bryan Christ <tragicwarrior>
Mon 31 Dec 2018 05:22:48 PM UTC, comment #3: 

Please try the attached patch.

Use --edge=<number> to show a colored bar at the desired column.

(file #45817)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 28 Dec 2018 08:11:32 PM UTC, comment #2: 

That all sounds good.  Just having a right hand margin of any kind would be a huge help.

Bryan Christ <tragicwarrior>
Fri 28 Dec 2018 07:09:32 PM UTC, comment #1: 

The same request was made two weeks ago by a Debian user: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916392

(I think I can do better than the preliminary patch I posted there, but I don't have the time to work on this at the moment.)

The extra 'marginwrap' option should not be needed: when the user wants to hard-wrap at a certain column, they should use --fill=xxx or 'set fill xxx'.  In other words, they should set --guideline and --fill to the same value.

A line would be hard to make on a character-based terminal.  It will have to be a vertical bar with a differing background color.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 28 Dec 2018 06:21:33 PM UTC, original submission:  

Allow the user to set a margin (max column) in the config file and display a vertical line at the specified column + 1.  Also, add an additional option, something like "set marginwrap", so that when wrapping is on, it can behave at either the screen edge (if marginwrap not set) or the margin edge (marginwrap is set).

Bryan Christ <tragicwarrior>


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by tragicwarrior (Submitted the item)
  • -email is unavailable- added by tragicwarrior

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 15 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-25 bens Open/ClosedOpen => Closed
    2019-03-09 bens StatusIn Progress => Fixed
    2019-03-03 bens Attached File- => Added 0001-new-feature-option-marginstripe-that-shows-a-vertica.patch, #46396
        Attached File- => Added 0002-rcfile-add-stripecolor-for-changing-the-color-of-the.patch, #46397
        Attached File- => Added 0003-docs-describe-the-new-options-J-marginstripe-and-set.patch, #46398
        Attached File- => Added 0004-syntax-nanorc-stop-coloring-unset-fill-.-as-if-it-we.patch, #46399
    2019-02-20 bens Attached File- => Added 0001-new-feature-option-edgecolumn-that-shows-a-vertical-.patch, #46315
    2019-01-19 bens Attached File- => Added backported-edgecolumn.patch, #46028
    2019-01-01 bens Attached File- => Added 0001-possible-new-feature-add-option-edgecolumn-that-show.patch, #45827
    2018-12-31 bens Attached File- => Added 0001-new-feature-add-option-edgecolumn-that-shows-a-verti.patch, #45817
        StatusNone => In Progress
    2018-12-30 bens Assigned toNone => bens
    2018-12-28 bens Severity3 - Normal => 1 - Wish
        Summary[Request] Display a margin => [Request] display a guiding margin line on the right
    2018-12-28 tragicwarrior Carbon-Copy- => Added bryan.christ@gmail.com

    Back to the top

    Powered by Savane 3.5