[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [PATCH] bug #28994: [Request] enable search (^W) in hel
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] [PATCH] bug #28994: [Request] enable search (^W) in help (^G) |
Date: |
Thu, 27 Oct 2016 10:25:36 +0200 |
On Wed, Oct 26, 2016, at 21:45, Rishabh Dave wrote:
> Attached patch is on the lines you proposed - writing help into
> a temp file and then opening the buffer for the temp file (link
> to the comment - https://savannah.gnu.org/bugs/?28994#comment3).
Thanks. Patch looks relatively good, and applies cleanly.
And it works! Nice.
However, after having pressed ^G and then ^X five times,
I have this in my /tmp:
-rw------- 1 ben ben 4668 2016-10-27 09:49 nano.4ViIng
-rw------- 1 ben ben 4668 2016-10-27 09:40 nano.hTFyE7
-rw------- 1 ben ben 4668 2016-10-27 09:40 nano.QwFyfn
-rw------- 1 ben ben 4668 2016-10-27 09:40 nano.SuTq8S
-rw------- 1 ben ben 4668 2016-10-27 09:40 nano.VkPROF
When exiting from help, you need to delete the temp file.
> First, in case of prompt and browser we redraw the screen (bottomwin
> and edit, respectively). So, to display the help text on screen we
> need to (re-)redraw it and (re-)relisten for shortcuts ("re-" because
> this is done by default when a buffer is opened). Initially, I felt
> this was an issue but later I felt it could be utilized as a solution
> -- view mode won't have to become per file attribute;
I can hardly follow your reasoning here.
> any attempt to
> enter text would lead to statusbar message "Unbound key."
Hm. Don't know if I like that. But let it be for now.
> Second, nano generates a temporary file per ^G. That... /could/ be
> pretty much and it stays till system reboots. Should it be of concern,
> or that is fine?
On my system (Ubuntu), /tmp is a real directory, on the disk.
It gets wiped upon a reboot, but as said above, it's better to
delete a temp file when you're done with it.
Also, instead of showing "File: /tmp/nano.uoyRxo" in the titlebar
you will have to show something like "Help text" there. Or better:
the first line (the title) of the help text itself.
> Third, help text gets displayed unwrapped, so I hard-wrapped it to
> make it look identical as it does now.
No, don't change the strings. That ruins all the translations.
> Never saw help text occupying
> the entire screen on maximizing terminal window,
Because there is a little routine in there that wraps the text
at the window's width or at column 74, whichever is smaller.
You have to do the same when writing out the help text to
a file, or better when initiliazing the help_text array: not
simply strcat() the hx[] parts, but properly wrap them first.
Otherwise you get things like this: with your current patch
run 'stty cols 50 && src/nano --soft' and press ^G. Oof.
That looks ugly.
> Most of the time was spent around fixing a segfault that occurred when
> following was done after running src/nano - ^R, ^G, ^W, ^C and 'e' (no
> other way to exit, also bottomwin remains stuck). Fix I came up with
> required touching src/prompt.c. I don't know how good that is, but the
> fix works. Also, similar issue, saving text entered at prompt when
> doing another prompt (before completing the initial i.e. ^R, ^G and
> ^W), is handled right above and below do_search() in src/help.c.
I haven't looked at your patch in detail. First the mentioned
issues will have to be fixed.
> Last, in help menu's bottomwin I have replaced positions of ^L by ^E
> and ^E and ^W, since ^L is present many menus in nano and it is never
> mentioned in bottombars; it looked like it was there only to avoid an
> empty space, so I replaced it.
I don't know what you mean with ^E -- I only see ^W and ^X in the
bottom lines of the help screen, and you have arranged them nicely.
So this is fine.
> And, sorry for the late reply; got busy. Testing isn't extensive and
> code could still be optimized. I wanted to attached finished patch but
> I figured I had already consuming lot of time.
There is no hurry whatsoever.
One detail:
+ if (prompt_save == NULL)
+ prompt = NULL;
+ else
+ prompt = prompt_save;
That is exactly the same as:
+ prompt = prompt_save;
Benno
--
http://www.fastmail.com - A fast, anti-spam email service.