Saving file position in mcedit

Pavel Roskin proski at gnu.org
Fri Nov 29 18:03:29 UTC 2002


Hello!

> > I'm doing minor cleanups now.  In particular, I changed
> > edit_move_to_column() to be much more effective (current patch is
> > attached for the curious).
>
> C is still a bit alien for me, that's why I made "a bit" strange
> modifications. Please care about that if you edit the EditPos file by
> hand or the file somehow modified by other person, and the column is
> over the end of line (if it's evidence for you, then sorry :).

I appreciate that you care about such cases.  Some people don't.  Now look
at this:

p = min (edit_bol (e, e->curs1) + column, edit_eol (e, e->curs1));

What do you think this "min" is for?

> > Any other reasons to tie positions to full filenames?
>
> Yes, I think. It could be strange for a user, that he edit "two files",
> and the positions are still the some. There must be a reason, why you
> make a link to another file. IMHO normally you won't edit the original
> and the link at the almost same time. With a tricky use of full
> filenames, you can make a link a file, and you can edit the file at two
> positions at the same time: you go to the original, edit it's first
> part, go to the link file, edit it's second part, etc... Don't think I
> think it serios, just an option.

OK, I'll leave the existing code then.

> An idea: we should store not just the xy, but screenxy positions, too.
> What do you think about?

You probably mean start_col and start_line.  I think it's a good idea.  By 
the way, it's much better to decide now what we are going to save, so that 
we don't have to change the format later.

> And another idea. Now both edit_move_to_column and edit_move_to_line
> subroutines are available in the editor. It's time to make it possible
> to store positions as bookmarks, for example Alt-0, Alt-1, Alt-2 going
> to bookmarks, Alt-S 0 stores the current position to the bookmark 0.
> Don't care about the examples, just the idea. The bookmark positions can
> be stored in the EditPos file, too.

There is already some bookmark code, but I'm not sure if anybody knows how
it works.  I think that it's better to save bookmarks in a separate file.  
Unlike saved positions, they are set explicitly by the user, and should be
treated as something more persistent.

> It could be another convenience if you edit a file at two positions at
> the same time, you don't have to use pgup/pgdown so much.

I normally use Alt-L and history in that dialog, but bookmarks would be a 
better solution.

-- 
Regards,
Pavel Roskin




More information about the mc-devel mailing list