Re: [PATCH] DRY browser.c implementation for to_first_file
Benno Schulenberg <[email protected]> Wed, 23 Apr 2025 11:49:26 +0200
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <[email protected]> |
Op 22-04-2025 om 20:36 schreef Peter Michaux: > The functions to_first_file and to_last_file appear to exist only for the > MWHEREISFILE menu. It seems a bit unexpected that these functions are in the > MWHEREISFILE menu as they are not text search related functions and they are > already in the MBROWSER menu The ^W^Y and ^W^V keystrokes exist in the file browser for historical reasons. So they will stay. Sure, the corresponding functions can also be accessed with a single keystroke (M-\ and M-/), but these are not visible in the help lines on a default terminal -- they get shown only when the terminal is at least 120 columns wide. So it is mildly useful to show them in the Where-Is-File menu. Furthermore, ^W^Y and ^W^V are available also in the main editor window (as "blind" bindings), so for symmetry they should be available in the file browser too. > If the two functions are to be in both menus, then it seems like a DRY > implementation would be an improvement. A suggested patch is attached. That does not improve anything. The existing comments say why those functions _must_ be there. When adding M-\ and M-/ to the comments the necessity is lost. > At a later date, the > browser code could be refactored without the static variables `filelist`, > `list_length`, etc at the top of the browser.c. Instead, a struct representing > the browser's current state could be passed between functions.] What good would that do? What is there against static variables? Benno
OpenPGP_signature.asc
(application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmgIt6cFAwAAAAAACgkQUUu+Lrjhlh+4 4g//fIywVViSXaOtTbyuJRLvlj1qPrRcME5w2o1ElPqA2RoDK6bEC2V/SjJ4uAGM4MnTp7wQPRpp paiq8fUubDu/f9/+AbaJoqzdlVwlhTDNFoqqqk1Zvu7XEyOHXtDEGWBOuAJuIVF4D+C8nobd4ZCB qmgzr+IHXoeu79BUqa0GttpyVwDZ48DtA60RgI5sjleXPwf2An6gerDc8U/nr/rT/i+QO/k/m0+1 hvVUwL1DL5yfIvAgUmlzCvnzoJVeIGk68qFNW6ipbHMgAKagst0M38skWogvIfMNHZJoq7R5jHO8 vfZKRDyGsrtZadvW0v3kSnw/w15gm2Ye7MI8sCvnddeeVR0REArCRqWSy5VMM2Uj5KJARIZgUmOd emA3zewg7W8GT+brL9Vsio7ziP6iPEozHhQ8kh1Og70a6D/KMsQmky6b5ClF8N0hc+te/u9qeHVr uM4eZFWrTxS8ZeCc/H6LZitqh1GHUzf1eEzWMd5lkvA9ITXGb3vJGOjD9ccyy7OZk6Z7B59eRASo lhmbOC0INSXTMU5USn3h5sF2c7ug3hbFLAvBVORBBpnsj6+LrwTjwLVg+7zEI6GX1RurD9FOT2ZL b+N8rVYFtW7OApxjc2GSMYm5GYnbEfa4tPzDgxhbjRLj96Yk0uioz5zQdxXXIG2Ujvt071qAjwyt smw= =YPJJ -----END PGP SIGNATURE-----