nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH] prevent position history overwrites across mult


From: Brand Huntsman
Subject: Re: [Nano-devel] [PATCH] prevent position history overwrites across multiple instances of nano
Date: Mon, 30 Oct 2017 14:53:43 -0600

On Mon, 30 Oct 2017 20:49:56 +0100
Benno Schulenberg <address@hidden> wrote:

> > Fixing the search/execute histories might not be possible since it
> > would alter the internal history of each instance, and no one would
> > want that to happen.  
> 
> Hmm...  I'm not so sure no one would want that.  I think I would like
> the search strings of a closed instance to be inserted into the
> history of other running instances, in a way as if these running
> instances had been started after the closed instance.

Option A
- reload a modified search_history when opening search prompt
- reload a modified search_history before updating it internally
- save search_history after every update
- don't save if history file wasn't reloaded and query is same as last query

It would write out the history file for every new query or when changing to an 
old query from history. History for every instance is identical, as if queries 
from other instances had been typed in every instance simultaneously. Say I'm 
cycling between two queries in instance A and using a third query in instance 
B. B's query will keep jumping to the top or between the queries in instance A. 
This would be a bit annoying.

Uses the same code as the filepos_history patch. But performs more stat checks 
and file read/writes.


Option B
- mark every query that is used
- no checking/reloading/saving of history file while instance is running
- at exit
-- check if history file changed and load into secondary list, update every 
marked query into secondary list, free primary list, move secondary to primary
-- save list

Upon closing a buffer, the other buffers would receive new history from other 
instances, but it would be placed behind all history they have been using. It 
prevents history from being overwritten, preserves per-instance history order 
and doesn't perform additional writes.

Option B.1
It could also be extended to check if history file is modified when search 
prompt is opened. If so, perform the same action that happens at exit, but 
don't save the list. This would pull in history from closed instances and place 
it behind used history.

Option B.2
Could extend it further by reloading history (if modified) after a 
new/different query and saving it. Every instance would always have the same 
history, but used history is always preserved at the top of each instance.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]