Compare commits
125 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a049e3233 | ||
|
|
31fdd2908b | ||
|
|
2404474dce | ||
|
|
5474a9f34b | ||
|
|
4bd423fc92 | ||
|
|
03d10941cc | ||
|
|
cc01bc3edb | ||
|
|
5f6f8a8083 | ||
|
|
e938c24d04 | ||
|
|
f55a3fabef | ||
|
|
7ee07af081 | ||
|
|
15ec0eb3ee | ||
|
|
7dad21f4f4 | ||
|
|
362965b9a3 | ||
|
|
eaa0f1a122 | ||
|
|
9923b073af | ||
|
|
9d9ae8dc76 | ||
|
|
ca6281e821 | ||
|
|
77826c2b06 | ||
|
|
89760cd6ec | ||
|
|
f02e2d3b6e | ||
|
|
252f14796e | ||
|
|
ae3ec1784d | ||
|
|
5662a38802 | ||
|
|
02eaa4ce6d | ||
|
|
636e9ac3e8 | ||
|
|
af71d44e4e | ||
|
|
e9ba058f3d | ||
|
|
9e2a12b62a | ||
|
|
5be94a3bbe | ||
|
|
518a2b4c45 | ||
|
|
e0d9fee5d6 | ||
|
|
065672bf12 | ||
|
|
477f63d8b5 | ||
|
|
95dd873205 | ||
|
|
e901387b72 | ||
|
|
280ac81b31 | ||
|
|
b7f53096fb | ||
|
|
f7f7767e7d | ||
|
|
91155486c7 | ||
|
|
63f2be7a2f | ||
|
|
71de0b9e2f | ||
|
|
b8c51329f6 | ||
|
|
bab5eeb808 | ||
|
|
d342cbbff8 | ||
|
|
5c5806bbe7 | ||
|
|
16a3dc90c7 | ||
|
|
769a0e661f | ||
|
|
6ed0a12d80 | ||
|
|
dda9d4e357 | ||
|
|
c43177487a | ||
|
|
f442f91187 | ||
|
|
33d67d5cee | ||
|
|
a4e7d6b80b | ||
|
|
06416e3d5c | ||
|
|
e1c8dd0091 | ||
|
|
b167444ee8 | ||
|
|
6b08648377 | ||
|
|
8c456423e9 | ||
|
|
53865ced9d | ||
|
|
c2e4f77594 | ||
|
|
7ea6d6bbda | ||
|
|
e4f5848425 | ||
|
|
ddd033adaf | ||
|
|
233a0807ec | ||
|
|
f9134af504 | ||
|
|
10d9742c11 | ||
|
|
2a894213e0 | ||
|
|
826be439db | ||
|
|
8bffc8ea53 | ||
|
|
fb8d981bfa | ||
|
|
915064870f | ||
|
|
401c49e611 | ||
|
|
eb9111a575 | ||
|
|
9c2b67231e | ||
|
|
b81995af8a | ||
|
|
339e0c131a | ||
|
|
2ee2407e63 | ||
|
|
5ca444e5df | ||
|
|
d245b07c25 | ||
|
|
d66a68166d | ||
|
|
13a4f3130d | ||
|
|
b32deee382 | ||
|
|
076bc31ce5 | ||
|
|
22c8ef6c39 | ||
|
|
c8852aa5e2 | ||
|
|
5f1b618a5a | ||
|
|
52ba76b2a2 | ||
|
|
5bb2b5c08a | ||
|
|
062b6691bb | ||
|
|
f4c958e810 | ||
|
|
4b32c62674 | ||
|
|
b4b9e9b012 | ||
|
|
0b63de335e | ||
|
|
628eef28b3 | ||
|
|
600295a3af | ||
|
|
bed997171c | ||
|
|
8d0b7a490d | ||
|
|
efa323ec88 | ||
|
|
4c6ec6377f | ||
|
|
c545438a5f | ||
|
|
e998814bbc | ||
|
|
fe6cb6e516 | ||
|
|
be69a7c299 | ||
|
|
33b576c289 | ||
|
|
1f39f60b2f | ||
|
|
818ee3e68c | ||
|
|
790f98560b | ||
|
|
d718ed4fc3 | ||
|
|
368ec04870 | ||
|
|
ce94cb1dc6 | ||
|
|
031f255ffd | ||
|
|
e8a5665d2c | ||
|
|
65e4784eec | ||
|
|
e2051a61e0 | ||
|
|
a8fa0a82c4 | ||
|
|
d19169c263 | ||
|
|
4e7b92ed4c | ||
|
|
eaeafe29ca | ||
|
|
fe3a72ce3e | ||
|
|
6cd53e7f44 | ||
|
|
b84d7bf7a5 | ||
|
|
6840205e84 | ||
|
|
3c5e5d4b6f | ||
|
|
09ab2e3d0e |
143
ChangeLog
143
ChangeLog
@@ -1,3 +1,146 @@
|
||||
Changes between v3.1 and v3.2:
|
||||
------------------------------
|
||||
|
||||
Benjamin Mintz (1):
|
||||
syntax: python: do not highlight 'print' and 'exec' in Python 3
|
||||
|
||||
Benno Schulenberg (87):
|
||||
bindings: allow using <Enter> to exit from the linter
|
||||
bindings: allow using ^X to exit from the linter
|
||||
bindings: drop M-| as a keystroke for 'cutwordleft' -- set it free again
|
||||
bindings: in tiny version with help, don't show unfunctional M-◀ and M-▶
|
||||
bindings: make <Alt+Up> and <Alt+Down> work also on a Linux console
|
||||
bindings: make the linter separately accessible, through M-B by default
|
||||
bindings: make the Shift+arrow keys work by default on more terminals
|
||||
bindings: no longer bind F13 and F14 and F15
|
||||
bindings: recognize ASCII DEL as backspace also in viewer and browser
|
||||
bindings: recognize <Ctrl+Shift+Delete> also on a Linux console
|
||||
bindings: rename 'prevhistory' to 'older' and 'nexthistory' to 'newer'
|
||||
bindings: stop binding <Bsp> to do_backspace() in the browser menu
|
||||
bindings: when implanting a string, make sure to use positive values
|
||||
build: exclude scrolling functions only from tiny version without help
|
||||
build: fix compilation again when configured with --enable-tiny
|
||||
build: fix compilation when configured with --disable-multibuffer
|
||||
build: verify that --enable-tiny compiles before allowing a release
|
||||
bump version numbers and add a news item for the 3.1 release
|
||||
debug: report for which modified editing keys ncurses has no keycode
|
||||
display: correct a mistaken label in the help lines of the browser
|
||||
display: ensure that the help lines are shown when in linting mode
|
||||
display: let the title bar show when nano is in linting mode
|
||||
display: show the cursor also in a help text (when --showcursor is used)
|
||||
display: use a different color when showing a linting message
|
||||
docs: document the slightly changed workings of the --view option
|
||||
docs: give suggestions for alternative key bindings in the sample nanorc
|
||||
docs: remove a no-longer-needed suggestion from the sample nanorc
|
||||
docs: update the description of -R/--restricted, as it now reads nanorc
|
||||
docs, usage: mention that --showcursor now covers help texts too
|
||||
feedback: give proper message for ^R when combining --view & --restricted
|
||||
gnulib: update to its current upstream state
|
||||
help: add a relevant explanatory text for the linter
|
||||
help: move the linter to the end, to restore pairing in the help lines
|
||||
help: pull "Older" and "Newer" into view on an 80-column terminal
|
||||
help: restore the blank line between manipulation and position stuff
|
||||
help: show <PgUp> and <PgDn> instead of F7 and F8 for pagewise scrolling
|
||||
help: show the keystroke <Ctrl+Shift+Delete> as "Sh-^Del"
|
||||
linter: allow using <Ctrl+Up> and <Ctrl+Down> to jump to other message
|
||||
linter: do not pause when there are no messages for unopened files
|
||||
linter: for "first"/"last", reshow actual message after a short pause
|
||||
options: --ignorercfiles is now available in restricted mode
|
||||
options: let view mode activate "multibuffer" to allow viewing more files
|
||||
speller: remove a pointless message -- it is never seen
|
||||
startup: allow reading nanorc in restricted mode, to permit customization
|
||||
syntaxes: remove several redundant end-of-line anchors from regexes
|
||||
tweaks: add a comment, and correct an indentation
|
||||
tweaks: add two more translator hints
|
||||
tweaks: capitalize the word "nano" when at the start of a sentence
|
||||
tweaks: change a bunch of URLs to use 'https' instead of 'http'
|
||||
tweaks: condense a handful of comments, and drop an assert
|
||||
tweaks: condense another bit of code
|
||||
tweaks: define a symbol to make the code itself a little simpler
|
||||
tweaks: don't bother asking ncurses for keycodes for shifted Left/Right
|
||||
tweaks: drop a check for the needle (the search string) being empty
|
||||
tweaks: drop the checking of two flags that can no longer be toggled
|
||||
tweaks: elide a function that is used just once and is a oneliner
|
||||
tweaks: elide a wrapper function that is no longer useful
|
||||
tweaks: exclude word-deletion keystrokes from the tiny version
|
||||
tweaks: fold a few pairs of regexes into each other
|
||||
tweaks: group a series of related variables together
|
||||
tweaks: improve two comments, and reshuffle a line for consistency
|
||||
tweaks: include an extra function call only where it is needed
|
||||
tweaks: move all the function keys to the end of the shortcuts list
|
||||
tweaks: move some calls of edit_redraw() to where they are needed
|
||||
tweaks: redefine MMOST to exclude MBROWSER, to simplify the bindings
|
||||
tweaks: reduce some repetitious and superfluous comments to just one
|
||||
tweaks: remove a check that was made redundant by the previous commit
|
||||
tweaks: remove a now-unused parameter from four functions
|
||||
tweaks: remove an unneeded check for NULL, and rename a parameter
|
||||
tweaks: remove a stray file that was accidentally comitted
|
||||
tweaks: remove some old debugging code
|
||||
tweaks: rename a bunch of variables, to make it clearer what they contain
|
||||
tweaks: rename a flag, to match the name of the option
|
||||
tweaks: rename a variable, to be a bit more fitting
|
||||
tweaks: renumber a couple of symbols, and reshuffle a bit of code
|
||||
tweaks: reorder some code to put backward motion before the forward one
|
||||
tweaks: reshuffle a couple of conditions, to group things better
|
||||
tweaks: reshuffle some conditions, putting the least likely one first
|
||||
tweaks: reshuffle some lines to get standard order (first up, then down)
|
||||
tweaks: reshuffle some lines, to put things in order of option name
|
||||
tweaks: snip trailing whitespace that ended with a non-breaking space
|
||||
tweaks: stop setting and requiring the Meta flag for special keycodes
|
||||
tweaks: swap and reword two bullet points in the rnano manpage
|
||||
tweaks: there is no reason to block SIGWINCHes while waiting for speller
|
||||
undo: move another piece of checking to the two places that need it
|
||||
undo: move some special checking code to the one place that needs it
|
||||
wrapping: make the --fill option override 'set fill' again
|
||||
|
||||
Brand Huntsman (5):
|
||||
bindings: hard-bind the zap function to M-Del (Alt+Delete)
|
||||
display: make all dying messages end in a newline
|
||||
linter: throttle "first"/"last" message on repeated key presses
|
||||
new feature: a bindable 'zap', to erase text without changing cutbuffer
|
||||
options: add --zap, that makes <Bsp> and <Del> erase a marked region
|
||||
|
||||
David Lawrence Ramsey (16):
|
||||
display: do spotlighting as part of drawing the screen
|
||||
docs: update rnano manpage, as -R/--restricted now reads nanorc
|
||||
input: don't detect <Ctrl+Shift+Delete> on Linux console in tiny version
|
||||
input: properly consume a modified Delete key also in the tiny version
|
||||
input: properly recognize Alt+Delete when using -K/--rebindkeypad
|
||||
input: recognize some escape sequences for <Shift+Delete>
|
||||
speller: restore the mark coordinates slightly later
|
||||
syntax: nanohelp: properly color the keystroke "Sh-^Del"
|
||||
tweaks: don't define controldelete or controlshiftdelete in tiny version
|
||||
tweaks: join two lines, and add a clarifying comment
|
||||
tweaks: move the justifying of a single paragraph into its own function
|
||||
tweaks: normalize the indentation of the shuffled code
|
||||
tweaks: reshuffle some code to avoid several checks for having justified
|
||||
tweaks: simplify by using a 'do/while' loop instead of 'while (TRUE)'
|
||||
weeding: remove the 'active' parameter from spotlight()
|
||||
wrapping: make relative fill values work again also for screen resizes
|
||||
|
||||
|
||||
Changes between v3.0 and v3.1:
|
||||
------------------------------
|
||||
|
||||
Benno Schulenberg (13):
|
||||
bindings: bind ASCII DEL during startup instead of repeatedly at runtime
|
||||
bindings: make ^H rebindable also on NetBSD, FreeBSD and macOS
|
||||
bindings: when Ctrl+Shift+Delete has no keycode, don't use KEY_BSP
|
||||
bump version numbers and add a news item for the 3.1 release
|
||||
input: keep the cursor in edit window after message, also on NetBSD
|
||||
input: recognize the sequences for Ctrl+Shift+Delete on xterm and urxvt
|
||||
main: allow toggling all editor features when in view mode
|
||||
suspension: don't try to show the cursor position when going to sleep
|
||||
syntax: sh: let the header regex match also busybox shell scripts
|
||||
tweaks: condense a bit of code
|
||||
tweaks: remove a superfluous comment and a redundant assignment
|
||||
tweaks: rename a variable to be special and distinct
|
||||
tweaks: sharpen an optimization, to allow DEL to be a shortcut
|
||||
|
||||
Liu Hao (1):
|
||||
search: disallow switching to the Replace prompt when in view mode
|
||||
|
||||
|
||||
Changes between v2.9.8 and v3.0:
|
||||
--------------------------------
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ Improvements in GNU nano
|
||||
========================
|
||||
|
||||
Since 3.0:
|
||||
- Addition of --zap to make <Del> and <Bsp> obliterate marked text.
|
||||
- <Ctrl+Delete> wipes next word and <Shift+Ctrl+Delete> preceding word.
|
||||
- An external spell check can be undone.
|
||||
|
||||
|
||||
28
NEWS
28
NEWS
@@ -1,3 +1,31 @@
|
||||
2018.11.11 - GNU nano 3.2 "Het kromme hout" changes the default binding
|
||||
for the linter to M-B so that the spell checker (^T) can
|
||||
always be used, and changes (when linting) the text in the
|
||||
title bar and the color of the status bar to make linting
|
||||
mode more obvious. It also adds a bindable 'zap' function
|
||||
for deleting a line or marked region without changing the
|
||||
cutbuffer, adds --zap to bind the <Del> and <Backspace>
|
||||
keys to the zap function when something is marked, and
|
||||
hard-binds <Alt+Del> to 'zap'. Furthermore, it shows the
|
||||
cursor also in the help viewer (when --showcursor is used),
|
||||
renames the bindable functions 'prevhistory' to 'older' and
|
||||
'nexthistory' to 'newer' (update your nanorcs when needed),
|
||||
reads the nanorc files also in restricted mode to allow
|
||||
customization by the user (if this should not be allowed,
|
||||
use --ignorercfiles in addition to --restricted), allows
|
||||
in view mode to open also other files (if this should not
|
||||
be allowed, use --restricted in addition to --view), makes
|
||||
resizes respect a relative --fill again, no longer binds
|
||||
F13...F15 by default, properly re-highlights a misspelled
|
||||
word after invoking help in the internal spell checker,
|
||||
and does not skip Unicode characters in string binds.
|
||||
|
||||
2018.09.18 - GNU nano 3.1 "Je faisais des bonds comme ça!" fixes a
|
||||
misbinding of ^H on some terminals and some systems,
|
||||
does not leave stray stuff after the prompt upon exit
|
||||
when having suspended nano while using --constantshow,
|
||||
and does not allow to toggle to Replace in view mode.
|
||||
|
||||
2018.09.09 - GNU nano 3.0 "Water Flowing Underground" speeds up the
|
||||
reading of a file by seventy percent, roughly doubles the
|
||||
speed of handling ASCII text, changes the way words at line
|
||||
|
||||
2
README
2
README
@@ -18,7 +18,7 @@ Overview
|
||||
providing other extra functionality.
|
||||
|
||||
The nano editor is an official GNU package. For more information on
|
||||
GNU and the Free Software Foundation, please see http://www.gnu.org/.
|
||||
GNU and the Free Software Foundation, please see https://www.gnu.org/.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="14df8ea0658c8902d1ea60bf57ce696cb51814f5"
|
||||
gnulib_hash="6ccfbb4ce5d4fa79f7afb48f3648f2e0401523c3"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
# along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [3.0], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [3.2], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE([1.14])
|
||||
|
||||
26
doc/faq.html
26
doc/faq.html
@@ -83,7 +83,7 @@
|
||||
<p><b>In the beginning...</b></p>
|
||||
<p>For years Pine was THE program used to read email on a Unix system. The Pico text editor is the portion of the program one would use to compose his or her mail messages. Many beginners to Unix flocked to Pico and Pine because of their well organized, easy to use interfaces. With the proliferation of GNU/Linux in the mid to late 90's, many University students became intimately familiar with the strengths (and weaknesses) of Pine and Pico.</p>
|
||||
<p><b>Then came Debian...</b></p>
|
||||
<p>The <a href="http://www.debian.org/">Debian GNU/Linux</a> distribution, known for its strict standards in distributing truly "free" software (i.e. software with no restrictions on redistribution), would not include a binary package for Pine or Pico. Many people had a serious dilemma: they loved these programs, but the versions available at the time were not truly free software in the <a href="http://www.gnu.org/philosophy/free-sw.html">GNU</a> sense of the word.</p>
|
||||
<p>The <a href="https://www.debian.org/">Debian GNU/Linux</a> distribution, known for its strict standards in distributing truly "free" software (i.e. software with no restrictions on redistribution), would not include a binary package for Pine or Pico. Many people had a serious dilemma: they loved these programs, but the versions available at the time were not truly free software in the <a href="https://www.gnu.org/philosophy/free-sw.html">GNU</a> sense of the word.</p>
|
||||
<p><b>The event...</b></p>
|
||||
<p>It was in late 1999 when Chris Allegretta (our hero) was yet again complaining to himself about the less-than-perfect license Pico was distributed under, the 1000 makefiles that came with it and how just a few small improvements could make it the Best Editor in the World (TM). Having been a convert from Slackware to Debian, he missed having a simple binary package that included Pine and Pico, and had grown tired of downloading them himself.</p>
|
||||
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help text display, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is in today.</p>
|
||||
@@ -91,7 +91,7 @@
|
||||
<h3><a name="1.3"></a>1.3. Why the name change from TIP?</h3>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h3><a name="1.4"></a>1.4. What is the current version of nano?</h3>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>3.0</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>3.2</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<h3><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h3>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
@@ -114,9 +114,9 @@
|
||||
<h3><a name="2.3"></a>2.3. Deb packages (Debian and derivatives):</h3>
|
||||
<blockquote><p>Debian users can check out the current nano packages for:</p>
|
||||
<ul>
|
||||
<li><a href="http://packages.debian.org/stable/editors/nano">stable</a></li>
|
||||
<li><a href="http://packages.debian.org/testing/editors/nano">testing</a></li>
|
||||
<li><a href="http://packages.debian.org/unstable/editors/nano">unstable</a></li>
|
||||
<li><a href="https://packages.debian.org/stable/editors/nano">stable</a></li>
|
||||
<li><a href="https://packages.debian.org/testing/editors/nano">testing</a></li>
|
||||
<li><a href="https://packages.debian.org/unstable/editors/nano">unstable</a></li>
|
||||
</ul>
|
||||
<p>You can also have a look at the <a href="ftp://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</p>
|
||||
</blockquote>
|
||||
@@ -232,9 +232,9 @@
|
||||
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
<h3><a name="5.1"></a>5.1. There's no translation for my language!</h3>
|
||||
<blockquote><p>In June 2001, GNU nano entered the <a href="http://translationproject.org/html/welcome.html">Translation Project</a> and since then, translations should be managed from there.</p>
|
||||
<p>If there isn't a translation for your language, you could ask <a href="http://translationproject.org/team/">your language team</a> to translate nano, or better still, join that team and do it yourself. Joining a team is easy. You just need to ask the team leader to add you, and then send a <a href="http://translationproject.org/disclaim.txt">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
|
||||
<p>In any case, translating nano is easy. Just grab the latest <b>nano.pot</b> file listed on <a href="http://translationproject.org/domain/nano.html">nano's page</a> at the TP, and translate each <b>msgid</b> line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central PO-file repository.</p></blockquote>
|
||||
<blockquote><p>In June 2001, GNU nano entered the <a href="https://translationproject.org/html/welcome.html">Translation Project</a> and since then, translations should be managed from there.</p>
|
||||
<p>If there isn't a translation for your language, you could ask <a href="https://translationproject.org/team/">your language team</a> to translate nano, or better still, join that team and do it yourself. Joining a team is easy. You just need to ask the team leader to add you, and then send a <a href="https://translationproject.org/disclaim.txt">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
|
||||
<p>In any case, translating nano is easy. Just grab the latest <b>nano.pot</b> file listed on <a href="https://translationproject.org/domain/nano.html">nano's page</a> at the TP, and translate each <b>msgid</b> line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central PO-file repository.</p></blockquote>
|
||||
<h3><a name="5.2"></a>5.2. I don't like the translation for <x> in my language. How can I fix it?</h3>
|
||||
<blockquote><p>The best way is to send an e-mail with your suggested corrections to the team's mailing list. The address is mentioned in the <code>Language-Team:</code> field in the relevant PO file. The team leader or the assigned translator can then make the changes reach the nano-devel list.</p></blockquote>
|
||||
<h3><a name="5.3"></a>5.3. What is the status of Unicode support?</h3>
|
||||
@@ -248,7 +248,7 @@
|
||||
<blockquote><p>Again, check out the <a href="https://nano-editor.org/">nano homepage</a> for a good summary of reasons. It really is a matter of personal preference as to which editor you should use. If you're the type of person who likes using the original version of a program, then Pico is the editor for you. If you don't mind sacrificing mailer integration with Pine, and are looking for a few more features, as well as a 'better' license in terms of adding your own changes, nano is the way to go.</p>
|
||||
<p>Note that the last of these no longer applies to the new version of Pine, <a href="http://www.washington.edu/alpine/">Alpine</a>, which is under the Apache License, version 2.0.</p></blockquote>
|
||||
<h3><a name="6.3"></a>6.3. What is so bad about the older Pine license?</h3>
|
||||
<blockquote><p>The U of W license for older versions of Pine and Pico is not considered truly Free Software according to both the Free Software Foundation and the <a href="http://www.debian.org/social_contract#guidelines">Debian Free Software Guidelines</a>. The main problem regards the limitations on distributing derived works: according to UW, you can distribute their software, and you can modify it, but you can not do both, i.e. distribute modified binaries.</p></blockquote>
|
||||
<blockquote><p>The U of W license for older versions of Pine and Pico is not considered truly Free Software according to both the Free Software Foundation and the <a href="https://www.debian.org/social_contract#guidelines">Debian Free Software Guidelines</a>. The main problem regards the limitations on distributing derived works: according to UW, you can distribute their software, and you can modify it, but you can not do both, i.e. distribute modified binaries.</p></blockquote>
|
||||
<h3><a name="6.4"></a>6.4. Okay, well, what mail program should I use then?</h3>
|
||||
<blockquote><p>If you are looking to use a Free Software program similar to Pine, and Emacs is not your thing, you should definitely take a look at <a href="http://www.mutt.org/">mutt</a>. It is a full-screen, console based mail program that actually has a lot more flexibility than Pine, but has a keymap included in the distribution that allows you to use the same keystrokes as Pine would to send and receive mail. It's also under the GNU General Public License, version 2.0.</p>
|
||||
<p>Of course, due to the license change you can now use the <a href="http://www.washington.edu/alpine/">Alpine distribution</a> of PINE as it is now considered Free Software, but you would be sacrificing many of nano's features to do so.</p></blockquote>
|
||||
@@ -256,10 +256,10 @@
|
||||
|
||||
<h1><a name="7"></a>7. Miscellaneous</h1>
|
||||
<h3><a name="7.1"></a>7.1. Where can I ask questions or send suggestions?</h3>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>: info-nano, help-nano and nano-devel. info-nano is a very low traffic list where new versions of nano are announced (surprise!). help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
<p>info-nano - <a href="http://mail.gnu.org/mailman/listinfo/info-nano/">http://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
|
||||
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="https://savannah.gnu.org/">Savannah</a>: info-nano, help-nano and nano-devel. info-nano is a very low traffic list where new versions of nano are announced (surprise!). help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
<p>info-nano - <a href="https://mail.gnu.org/mailman/listinfo/info-nano/">https://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
|
||||
help-nano - <a href="https://mail.gnu.org/mailman/listinfo/help-nano/">https://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="https://mail.gnu.org/mailman/listinfo/nano-devel/">https://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<h3><a name="7.2"></a>7.3. How do I submit a bug report or patch?</h3>
|
||||
<blockquote>
|
||||
<p>The best way to submit bugs is through the <a href="https://savannah.gnu.org/bugs/?group=nano">Savannah bug tracker</a>, as you can check whether the bug you are reporting has already been submitted, and it makes it easier for the maintainers to keep track of them.
|
||||
|
||||
25
doc/nano.1
25
doc/nano.1
@@ -7,16 +7,16 @@
|
||||
.\" Foundation, version 3 or (at your option) any later version. You
|
||||
.\" should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * The GNU Free Documentation License, as published by the Free
|
||||
.\" Software Foundation, version 1.2 or (at your option) any later
|
||||
.\" version, with no Invariant Sections, no Front-Cover Texts, and no
|
||||
.\" Back-Cover Texts. You should have received a copy of the GNU Free
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 3.0" "September 2018"
|
||||
.TH NANO 1 "version 3.2" "November 2018"
|
||||
|
||||
.SH NAME
|
||||
nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
@@ -131,11 +131,11 @@ Note that \fB\\t\fP stands for an actual Tab.
|
||||
.TP
|
||||
.BR \-R ", " \-\-restricted
|
||||
Restricted mode: don't read or write to any file not specified on the
|
||||
command line; don't read any \fInanorc\fP files nor history files;
|
||||
don't allow suspending nor spell checking;
|
||||
command line. This means: don't read or write history files;
|
||||
don't allow suspending; don't allow spell checking;
|
||||
don't allow a file to be appended to, prepended to, or saved under a
|
||||
different name if it already has one; and don't use backup files.
|
||||
This restricted mode is also accessible by invoking \fBnano\fP
|
||||
different name if it already has one; and don't make backup files.
|
||||
Restricted mode can also be activated by invoking \fBnano\fP
|
||||
with any name beginning with 'r' (e.g. "rnano").
|
||||
.TP
|
||||
.BR \-S ", " \-\-smooth
|
||||
@@ -167,6 +167,10 @@ should be considered as part of a word. This overrides option
|
||||
Specify the name of the syntax highlighting to use from among the ones
|
||||
defined in the \fInanorc\fP files.
|
||||
.TP
|
||||
.BR \-Z ", " \-\-zap
|
||||
Let an unmodified Backspace or Delete erase the marked region
|
||||
(instead of a single character, and without affecting the cutbuffer).
|
||||
.TP
|
||||
.BR \-a ", " \-\-atblanks
|
||||
When doing soft line wrapping, wrap lines at whitespace
|
||||
instead of always at the edge of the screen.
|
||||
@@ -181,8 +185,9 @@ work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
.BR \-g ", " \-\-showcursor
|
||||
Make the cursor visible in the file browser, putting it on the
|
||||
highlighted item. Useful for braille users.
|
||||
Make the cursor visible in the file browser (putting it on the
|
||||
highlighted item) and in the help viewer. Useful for braille users
|
||||
and people with poor vision.
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
Show a summary of the available command-line options and exit.
|
||||
@@ -244,6 +249,8 @@ default behavior of saving a file in the format that it had.
|
||||
.TP
|
||||
.BR \-v ", " \-\-view
|
||||
Just view the file and disallow editing: read-only mode.
|
||||
This mode allows the user to open also other files for viewing,
|
||||
unless \fB--restricted\fR is given too.
|
||||
.TP
|
||||
.BR \-w ", " \-\-nowrap
|
||||
Disable the hard-wrapping of long lines. This option conflicts with
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.5
|
||||
@set VERSION 3.0
|
||||
@set UPDATED September 2018
|
||||
@set VERSION 3.2
|
||||
@set UPDATED November 2018
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @command{nano}
|
||||
@subtitle a small and friendly text editor
|
||||
@subtitle version 3.0
|
||||
@subtitle version 3.2
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -43,14 +43,14 @@ under the terms of either of the following licenses:
|
||||
* The GNU General Public License, as published by the Free Software
|
||||
Foundation, version 3 or (at your option) any later version. You
|
||||
should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see @url{http://www.gnu.org/licenses/}.
|
||||
with this program. If not, see @url{https://www.gnu.org/licenses/}.
|
||||
|
||||
@sp 1
|
||||
* The GNU Free Documentation License, as published by the Free Software
|
||||
Foundation, version 1.2 or (at your option) any later version, with no
|
||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
You should have received a copy of the GNU Free Documentation License
|
||||
along with this program. If not, see @url{http://www.gnu.org/licenses/}.
|
||||
along with this program. If not, see @url{https://www.gnu.org/licenses/}.
|
||||
|
||||
@sp 1
|
||||
You may contact the author by
|
||||
@@ -63,7 +63,7 @@ e-mail: @email{chrisa@@asty.org}@*
|
||||
@node Top
|
||||
@top
|
||||
|
||||
This manual documents the GNU @command{nano} editor, version 3.0.
|
||||
This manual documents the GNU @command{nano} editor, version 3.2.
|
||||
|
||||
@menu
|
||||
* Introduction::
|
||||
@@ -227,11 +227,11 @@ Note that @code{\t} stands for a literal Tab character.
|
||||
@item -R
|
||||
@itemx --restricted
|
||||
Restricted mode: don't read or write to any file not specified on the
|
||||
command line; don't read any nanorc files nor history files; don't allow
|
||||
suspending nor spell checking; don't
|
||||
command line. This means: don't read or write history files; don't allow
|
||||
suspending; don't allow spell checking; don't
|
||||
allow a file to be appended to, prepended to, or saved under a different
|
||||
name if it already has one; and don't use backup files.
|
||||
This restricted mode is also accessible by invoking @command{nano} with
|
||||
name if it already has one; and don't make backup files.
|
||||
Restricted mode can also be activated by invoking @command{nano} with
|
||||
any name beginning with @code{r} (e.g.@: @command{rnano}).
|
||||
|
||||
@item -S
|
||||
@@ -270,6 +270,11 @@ should be considered as parts of words. This overrides option
|
||||
Specify the syntax to be used for highlighting.
|
||||
@xref{Syntax Highlighting} for more info.
|
||||
|
||||
@item -Z
|
||||
@itemx --zap
|
||||
Let an unmodified @key{Backspace} or @key{Delete} erase the marked region
|
||||
(instead of a single character, and without affecting the cutbuffer).
|
||||
|
||||
@item -a
|
||||
@itemx --atblanks
|
||||
When doing soft line wrapping, wrap lines at whitespace
|
||||
@@ -289,8 +294,9 @@ acts like Delete on your system.
|
||||
|
||||
@item -g
|
||||
@itemx --showcursor
|
||||
Make the cursor visible in the file browser, putting it on the
|
||||
highlighted item. Useful for braille users.
|
||||
Make the cursor visible in the file browser (putting it on the
|
||||
highlighted item) and in the help viewer. Useful for braille users
|
||||
and people with poor vision.
|
||||
|
||||
@item -h
|
||||
@itemx --help
|
||||
@@ -373,9 +379,11 @@ default behavior of saving a file in the format that it had.
|
||||
|
||||
@item -v
|
||||
@itemx --view
|
||||
Don't allow the contents of the file to be altered. Note that this
|
||||
option should NOT be used in place of correct file permissions to
|
||||
implement a read-only file.
|
||||
Don't allow the contents of the file to be altered: read-only mode.
|
||||
This mode allows the user to open also other files for viewing,
|
||||
unless @option{--restricted} is given too.
|
||||
(Note that this option should NOT be used in place of correct
|
||||
file permissions to implement a read-only file.)
|
||||
|
||||
@item -w
|
||||
@itemx --nowrap
|
||||
@@ -857,8 +865,9 @@ Use this color combination for selected text.
|
||||
@xref{@code{set functioncolor}} for valid color names.
|
||||
|
||||
@item set showcursor
|
||||
Put the cursor on the highlighted item in the file browser, to aid
|
||||
braille users.
|
||||
Put the cursor on the highlighted item in the file browser, and show
|
||||
the cursor in the help viewer, to aid braille users and people with
|
||||
poor vision.
|
||||
|
||||
@item set smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
@@ -909,7 +918,9 @@ default behavior of saving a file in the format that it had.
|
||||
(This option has no effect when you also use @code{set noconvert}.)
|
||||
|
||||
@item set view
|
||||
Disallow file modification.
|
||||
Disallow file modification: read-only mode.
|
||||
This mode allows the user to open also other files for viewing,
|
||||
unless @option{--restricted} is given on the command line.
|
||||
|
||||
@anchor{Whitespace}
|
||||
@item set whitespace "@var{string}"
|
||||
@@ -926,6 +937,10 @@ Specify which other characters (besides the normal alphanumeric ones)
|
||||
should be considered as parts of words. This overrides the option
|
||||
@code{wordbounds}.
|
||||
|
||||
@item set zap
|
||||
Let an unmodified @key{Backspace} or @key{Delete} erase the marked region
|
||||
(instead of a single character, and without affecting the cutbuffer).
|
||||
|
||||
@end table
|
||||
|
||||
@node Syntax Highlighting
|
||||
@@ -1144,6 +1159,10 @@ Pastes the currently stored text into the current buffer at the
|
||||
current cursor position.
|
||||
(The old form 'uncut' is deprecated.)
|
||||
|
||||
@item zap
|
||||
Throw away the current line (or the marked region).
|
||||
(This function is bound by default to <Meta+Delete>.)
|
||||
|
||||
@item cutwordleft
|
||||
Cuts from the cursor position to the beginning of the preceding word.
|
||||
(This function is not bound by default. If your terminal produces
|
||||
@@ -1310,11 +1329,11 @@ Toggles whether searching/replacing uses literal strings or regular expressions.
|
||||
@item backwards
|
||||
Toggles whether searching/replacing goes forward or backward.
|
||||
|
||||
@item prevhistory
|
||||
Retrieves the previous (older) entry at a prompt.
|
||||
@item older
|
||||
Retrieves the previous (earlier) entry at a prompt.
|
||||
|
||||
@item nexthistory
|
||||
Retrieves the next (newer) entry at a prompt.
|
||||
@item newer
|
||||
Retrieves the next (later) entry at a prompt.
|
||||
|
||||
@item flipreplace
|
||||
Toggles between searching for something and replacing something.
|
||||
|
||||
26
doc/nanorc.5
26
doc/nanorc.5
@@ -7,16 +7,16 @@
|
||||
.\" Foundation, version 3 or (at your option) any later version. You
|
||||
.\" should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * The GNU Free Documentation License, as published by the Free
|
||||
.\" Software Foundation, version 1.2 or (at your option) any later
|
||||
.\" version, with no Invariant Sections, no Front-Cover Texts, and no
|
||||
.\" Back-Cover Texts. You should have received a copy of the GNU Free
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 3.0" "September 2018"
|
||||
.TH NANORC 5 "version 3.2" "November 2018"
|
||||
|
||||
.SH NAME
|
||||
nanorc \- GNU nano's configuration file
|
||||
@@ -280,7 +280,9 @@ default behavior of saving a file in the format that it had.
|
||||
(This option has no effect when you also use \fBset noconvert\fR.)
|
||||
.TP
|
||||
.B set view
|
||||
Disallow file modification.
|
||||
Disallow file modification: read-only mode.
|
||||
This mode allows the user to open also other files for viewing,
|
||||
unless \fB--restricted\fR is given on the command line.
|
||||
.TP
|
||||
.B set whitespace "\fIstring\fP"
|
||||
Set the two characters used to indicate the presence of tabs and
|
||||
@@ -295,6 +297,10 @@ characters as parts of words.
|
||||
Specify which other characters (besides the normal alphanumeric ones)
|
||||
should be considered as parts of words. This overrides the option
|
||||
\fBwordbounds\fR.
|
||||
.TP
|
||||
.B set zap
|
||||
Let an unmodified Backspace or Delete erase the marked region
|
||||
(instead of a single character, and without affecting the cutbuffer).
|
||||
|
||||
.SH SYNTAX HIGHLIGHTING
|
||||
Coloring the different syntactic elements of a file
|
||||
@@ -504,6 +510,10 @@ Pastes the currently stored text into the current buffer at the
|
||||
current cursor position.
|
||||
(The old form 'uncut' is deprecated.)
|
||||
.TP
|
||||
.B zap
|
||||
Throw away the current line (or the marked region).
|
||||
(This function is bound by default to <Meta+Delete>.)
|
||||
.TP
|
||||
.B cutwordleft
|
||||
Cuts from the cursor position to the beginning of the preceding word.
|
||||
(This function is not bound by default. If your terminal produces
|
||||
@@ -673,11 +683,11 @@ Toggles whether searching/replacing uses literal strings or regular expressions.
|
||||
.B backwards
|
||||
Toggles whether searching/replacing goes forward or backward.
|
||||
.TP
|
||||
.B prevhistory
|
||||
Retrieves the previous (older) entry at a prompt.
|
||||
.B older
|
||||
Retrieves the previous (earlier) entry at a prompt.
|
||||
.TP
|
||||
.B nexthistory
|
||||
Retrieves the next (newer) entry at a prompt.
|
||||
.B newer
|
||||
Retrieves the next (later) entry at a prompt.
|
||||
.TP
|
||||
.B flipreplace
|
||||
Toggles between searching for something and replacing something.
|
||||
|
||||
12
doc/rnano.1
12
doc/rnano.1
@@ -7,16 +7,16 @@
|
||||
.\" Foundation, version 3 or (at your option) any later version. You
|
||||
.\" should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * The GNU Free Documentation License, as published by the Free
|
||||
.\" Software Foundation, version 1.2 or (at your option) any later
|
||||
.\" version, with no Invariant Sections, no Front-Cover Texts, and no
|
||||
.\" Back-Cover Texts. You should have received a copy of the GNU Free
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\" <https://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 3.0" "September 2018"
|
||||
.TH RNANO 1 "version 3.2" "November 2018"
|
||||
|
||||
.SH NAME
|
||||
rnano \- a restricted nano
|
||||
@@ -32,13 +32,11 @@ access to the filesystem nor to a command shell.
|
||||
.PP
|
||||
In restricted mode, \fBnano\fR will:
|
||||
.IP \[bu] 2
|
||||
not read any nanorc files;
|
||||
.IP \[bu]
|
||||
not allow suspending;
|
||||
.IP \[bu]
|
||||
not read nor write any file not specified on the command line;
|
||||
not allow saving the current buffer under a different name;
|
||||
.IP \[bu]
|
||||
not allow saving a file under a different name;
|
||||
not allow inserting another file or opening a new buffer;
|
||||
.IP \[bu]
|
||||
not allow appending or prepending to any file;
|
||||
.IP \[bu]
|
||||
|
||||
@@ -136,8 +136,9 @@
|
||||
## Do extended regular expression searches by default.
|
||||
# set regexp
|
||||
|
||||
## Put the cursor on the highlighted item in the file browser;
|
||||
## useful for people who use a braille display.
|
||||
## Put the cursor on the highlighted item in the file browser, and show
|
||||
## the cursor in the help viewer; useful for people who use a braille
|
||||
## display and people with poor vision.
|
||||
# set showcursor
|
||||
|
||||
## Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
@@ -193,6 +194,9 @@
|
||||
## set, it overrides option 'set wordbounds'.
|
||||
# set wordchars "<_>."
|
||||
|
||||
## Let an unmodified Backspace or Delete erase the marked region (instead
|
||||
## of a single character, and without affecting the cutbuffer).
|
||||
# set zap
|
||||
|
||||
## Paint the interface elements of nano. These are examples;
|
||||
## by default there are no colors, except for errorcolor.
|
||||
@@ -261,10 +265,6 @@
|
||||
## Key bindings.
|
||||
## See nanorc(5) (section REBINDING KEYS) for more details on this.
|
||||
|
||||
## If your Backspace key behaves as Delete (when ssh'ing in from another
|
||||
## machine, for example), set this to make it behave as Backspace again:
|
||||
# bind Del backspace all
|
||||
|
||||
## The <Ctrl+Delete> keystroke deletes the word to the right of the cursor.
|
||||
## On some terminals the <Ctrl+Backspace> keystroke produces ^H, which is
|
||||
## the ASCII character for backspace, so it is bound by default to the
|
||||
@@ -273,3 +273,35 @@
|
||||
## normally use <Backspace> for backspacing and not ^H, you can make
|
||||
## <Ctrl+Backspace> delete the word to the left of the cursor with:
|
||||
# bind ^H cutwordleft main
|
||||
|
||||
## If you would like nano to have keybindings that are more "usual",
|
||||
## such as ^O for Open, ^F for Find, ^H for Help, and ^Q for Quit,
|
||||
## then uncomment these:
|
||||
#bind ^Q exit all
|
||||
#bind ^H help all
|
||||
#bind ^H exit help
|
||||
#bind ^F whereis all
|
||||
#bind ^G findnext all
|
||||
#bind ^B wherewas all
|
||||
#bind ^D findprevious all
|
||||
#bind ^R replace main
|
||||
#bind ^W writeout main
|
||||
#bind ^O insert main
|
||||
#unbind ^V all
|
||||
#unbind ^Y all
|
||||
#bind M-X flipnewbuffer all
|
||||
#bind ^X cut all
|
||||
#bind ^C copy all
|
||||
#bind ^V paste all
|
||||
#bind ^P curpos main
|
||||
#bind ^T gotoline main
|
||||
#bind ^T gotodir browser
|
||||
#bind ^Y speller main
|
||||
#unbind ^K all
|
||||
#unbind ^U all
|
||||
#bind M-R redo main
|
||||
#bind ^U undo main
|
||||
#bind ^E redo main
|
||||
#unbind M-J main
|
||||
#unbind M-T main
|
||||
#set multibuffer
|
||||
|
||||
1250
po/nano.pot
1250
po/nano.pot
File diff suppressed because it is too large
Load Diff
1077
po/pt_BR.po
1077
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1084
po/zh_CN.po
1084
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1137
po/zh_TW.po
1137
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION="3.0"
|
||||
VERSION="3.2"
|
||||
|
||||
./configure -C --enable-tiny && make &&
|
||||
./configure -C --disable-wrapping-as-root &&
|
||||
|
||||
echo "Pulling..." && git pull &&
|
||||
echo "Running autogen..." && ./autogen.sh &&
|
||||
rm -v -f m4/*.m4~ *.asc *.sig *.gz *.xz &&
|
||||
|
||||
|
||||
@@ -462,10 +462,11 @@ functionptrtype parse_browser_input(int *kbinput)
|
||||
{
|
||||
if (!meta_key) {
|
||||
switch (*kbinput) {
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case DEL_CODE:
|
||||
case '-':
|
||||
return do_page_up;
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case '?':
|
||||
return do_help_void;
|
||||
case 'E':
|
||||
|
||||
54
src/cut.c
54
src/cut.c
@@ -33,12 +33,6 @@ void cutbuffer_reset(void)
|
||||
keep_cutbuffer = FALSE;
|
||||
}
|
||||
|
||||
/* Return the status of cutbuffer preservation. */
|
||||
inline bool keeping_cutbuffer(void)
|
||||
{
|
||||
return keep_cutbuffer;
|
||||
}
|
||||
|
||||
/* If we aren't on the last line of the file, move all the text of the
|
||||
* current line, plus the newline at the end, into the cutbuffer. If we
|
||||
* are, move all of the text of the current line into the cutbuffer. In
|
||||
@@ -110,8 +104,9 @@ void cut_to_eof(void)
|
||||
/* Move text from the current buffer into the cutbuffer. If
|
||||
* copy_text is TRUE, copy the text back into the buffer afterward.
|
||||
* If cut_till_eof is TRUE, move all text from the current cursor
|
||||
* position to the end of the file into the cutbuffer. */
|
||||
void do_cut_text(bool copy_text, bool marked, bool cut_till_eof)
|
||||
* position to the end of the file into the cutbuffer. If append
|
||||
* is TRUE (when zapping), always append the cut to the cutbuffer. */
|
||||
void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
filestruct *cb_save = NULL;
|
||||
@@ -126,7 +121,7 @@ void do_cut_text(bool copy_text, bool marked, bool cut_till_eof)
|
||||
size_t was_totsize = openfile->totsize;
|
||||
|
||||
/* If cuts were not continuous, or when cutting a region, clear the slate. */
|
||||
if (!keep_cutbuffer || marked || cut_till_eof) {
|
||||
if (!append && (!keep_cutbuffer || marked || cut_till_eof)) {
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
/* After a line cut, future line cuts should add to the cutbuffer. */
|
||||
@@ -193,11 +188,16 @@ void do_cut_text(bool copy_text, bool marked, bool cut_till_eof)
|
||||
void do_cut_text_void(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
add_undo(CUT);
|
||||
do_cut_text(FALSE, openfile->mark, FALSE);
|
||||
/* Only add a new undo item when the current item is not a CUT or when
|
||||
* the current cut is not contiguous with the previous cutting. */
|
||||
if (openfile->last_action != CUT || openfile->current_undo == NULL ||
|
||||
openfile->current_undo->mark_begin_lineno != openfile->current->lineno ||
|
||||
!keep_cutbuffer)
|
||||
add_undo(CUT);
|
||||
do_cut_text(FALSE, openfile->mark, FALSE, FALSE);
|
||||
update_undo(CUT);
|
||||
#else
|
||||
do_cut_text(FALSE, FALSE, FALSE);
|
||||
do_cut_text(FALSE, FALSE, FALSE, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ void do_copy_text(void)
|
||||
if (mark_is_set || openfile->current != next_contiguous_line)
|
||||
cutbuffer_reset();
|
||||
|
||||
do_cut_text(TRUE, mark_is_set, FALSE);
|
||||
do_cut_text(TRUE, mark_is_set, FALSE, FALSE);
|
||||
|
||||
/* If the mark was set, blow away the cutbuffer on the next copy. */
|
||||
next_contiguous_line = (mark_is_set ? NULL : openfile->current);
|
||||
@@ -237,9 +237,35 @@ void do_copy_text(void)
|
||||
void do_cut_till_eof(void)
|
||||
{
|
||||
add_undo(CUT_TO_EOF);
|
||||
do_cut_text(FALSE, FALSE, TRUE);
|
||||
do_cut_text(FALSE, FALSE, TRUE, FALSE);
|
||||
update_undo(CUT_TO_EOF);
|
||||
}
|
||||
|
||||
/* Erase text (current line or marked region), sending it into oblivion. */
|
||||
void zap_text(void)
|
||||
{
|
||||
/* Remember the current cutbuffer so it can be restored after the zap. */
|
||||
filestruct *was_cutbuffer = cutbuffer;
|
||||
filestruct *was_cutbottom = cutbottom;
|
||||
|
||||
/* Add a new undo item only when the current item is not a ZAP or when
|
||||
* the current zap is not contiguous with the previous zapping. */
|
||||
if (openfile->last_action != ZAP || openfile->current_undo == NULL ||
|
||||
openfile->current_undo->mark_begin_lineno != openfile->current->lineno ||
|
||||
openfile->current_undo->xflags & (MARK_WAS_SET|WAS_MARKED_FORWARD))
|
||||
add_undo(ZAP);
|
||||
|
||||
/* Use the cutbuffer from the ZAP undo item, so the cut can be undone. */
|
||||
cutbuffer = openfile->current_undo->cutbuffer;
|
||||
cutbottom = openfile->current_undo->cutbottom;
|
||||
|
||||
do_cut_text(FALSE, openfile->mark, FALSE, TRUE);
|
||||
|
||||
update_undo(ZAP);
|
||||
|
||||
cutbuffer = was_cutbuffer;
|
||||
cutbottom = was_cutbottom;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Copy text from the cutbuffer into the current buffer. */
|
||||
|
||||
19
src/files.c
19
src/files.c
@@ -62,7 +62,7 @@ bool has_valid_path(const char *filename)
|
||||
/* Add an item to the circular list of openfile structs. */
|
||||
void make_new_buffer(void)
|
||||
{
|
||||
openfilestruct *newnode = make_new_opennode();
|
||||
openfilestruct *newnode = nmalloc(sizeof(openfilestruct));
|
||||
|
||||
if (openfile == NULL) {
|
||||
/* Make the first open file the only element in the list. */
|
||||
@@ -533,7 +533,7 @@ void replace_buffer(const char *filename)
|
||||
#ifndef NANO_TINY
|
||||
add_undo(CUT_TO_EOF);
|
||||
#endif
|
||||
do_cut_text(FALSE, FALSE, TRUE);
|
||||
do_cut_text(FALSE, FALSE, TRUE, FALSE);
|
||||
#ifndef NANO_TINY
|
||||
update_undo(CUT_TO_EOF);
|
||||
#endif
|
||||
@@ -574,7 +574,7 @@ void replace_marked_buffer(const char *filename)
|
||||
/* Throw away the text under the mark. */
|
||||
cutbuffer = NULL;
|
||||
add_undo(CUT);
|
||||
do_cut_text(FALSE, TRUE, FALSE);
|
||||
do_cut_text(FALSE, TRUE, FALSE, FALSE);
|
||||
update_undo(CUT);
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = was_cutbuffer;
|
||||
@@ -687,7 +687,7 @@ bool close_buffer(void)
|
||||
return FALSE;
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
if (ISSET(POS_HISTORY))
|
||||
if (ISSET(POSITIONLOG))
|
||||
update_poshistory(openfile->filename,
|
||||
openfile->current->lineno, xplustabs() + 1);
|
||||
#endif
|
||||
@@ -1221,7 +1221,7 @@ void do_insertfile(void)
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER)) {
|
||||
#ifdef ENABLE_HISTORIES
|
||||
if (ISSET(POS_HISTORY)) {
|
||||
if (ISSET(POSITIONLOG)) {
|
||||
ssize_t priorline, priorcol;
|
||||
#ifndef NANO_TINY
|
||||
if (!execute)
|
||||
@@ -1258,10 +1258,6 @@ void do_insertfile_void(void)
|
||||
{
|
||||
if (ISSET(RESTRICTED))
|
||||
show_restricted_warning();
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
else if (ISSET(VIEW_MODE) && !ISSET(MULTIBUFFER))
|
||||
statusbar(_("Key invalid in non-multibuffer mode"));
|
||||
#endif
|
||||
else
|
||||
do_insertfile();
|
||||
}
|
||||
@@ -1904,13 +1900,12 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
while (fileptr != NULL) {
|
||||
size_t data_len = strlen(fileptr->data), size;
|
||||
|
||||
/* Convert newlines to nulls, just before we write to disk. */
|
||||
/* Decode LFs as the NULs that they are, before writing to disk. */
|
||||
sunder(fileptr->data);
|
||||
|
||||
size = fwrite(fileptr->data, sizeof(char), data_len, f);
|
||||
|
||||
/* Convert nulls to newlines. data_len is the string's real
|
||||
* length. */
|
||||
/* Re-encode any embedded NULs as LFs. */
|
||||
unsunder(fileptr->data, data_len);
|
||||
|
||||
if (size < data_len) {
|
||||
|
||||
210
src/global.c
210
src/global.c
@@ -68,18 +68,23 @@ bool also_the_last = FALSE;
|
||||
int didfind = 0;
|
||||
/* Whether the last search found something. */
|
||||
|
||||
int controlleft, controlright, controlup, controldown, controlhome, controlend;
|
||||
int controldelete, controlshiftdelete;
|
||||
int controlleft, controlright, controlup, controldown;
|
||||
int controlhome, controlend;
|
||||
#ifndef NANO_TINY
|
||||
int controldelete, controlshiftdelete;
|
||||
int shiftleft, shiftright, shiftup, shiftdown;
|
||||
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
||||
int shiftcontrolhome, shiftcontrolend;
|
||||
int altleft, altright, altup, altdown;
|
||||
int altdelete;
|
||||
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
ssize_t fill = -COLUMNS_FROM_EOL;
|
||||
/* The column where we will wrap lines. */
|
||||
ssize_t wrap_at = -COLUMNS_FROM_EOL;
|
||||
/* The relative column where we will wrap lines. */
|
||||
ssize_t fill = 0;
|
||||
/* The actual column where we will wrap lines, based on wrap_at. */
|
||||
#endif
|
||||
|
||||
char *last_search = NULL;
|
||||
@@ -120,8 +125,7 @@ openfilestruct *firstfile = NULL;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
char *matchbrackets = NULL;
|
||||
/* The opening and closing brackets that can be found by bracket
|
||||
* searches. */
|
||||
/* The opening and closing brackets that bracket searches can find. */
|
||||
char *whitespace = NULL;
|
||||
/* The characters used when visibly showing tabs and spaces. */
|
||||
int whitespace_len[2];
|
||||
@@ -257,6 +261,13 @@ char *rcfile_with_errors = NULL;
|
||||
/* The first nanorc file, if any, that produced warnings. */
|
||||
#endif
|
||||
|
||||
bool spotlighted = FALSE;
|
||||
/* Whether any text is spotlighted. */
|
||||
size_t light_from_col = 0;
|
||||
/* Where the spotlighted text starts. */
|
||||
size_t light_to_col = 0;
|
||||
/* Where the spotlighted text ends. */
|
||||
|
||||
/* Return the number of entries in the shortcut list for a given menu. */
|
||||
size_t length_of_list(int menu)
|
||||
{
|
||||
@@ -275,6 +286,11 @@ size_t length_of_list(int menu)
|
||||
#define NOVIEW FALSE
|
||||
#define BLANKAFTER TRUE /* A blank line after this one. */
|
||||
#define TOGETHER FALSE
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
#define CAN_OPEN_OTHER_BUFFER TRUE
|
||||
#else
|
||||
#define CAN_OPEN_OTHER_BUFFER FALSE
|
||||
#endif
|
||||
|
||||
/* Empty functions, for the most part corresponding to toggles. */
|
||||
void case_sens_void(void)
|
||||
@@ -445,9 +461,7 @@ functionptrtype func_from_key(int *kbinput)
|
||||
void assign_keyinfo(sc *s, const char *keystring, const int keycode)
|
||||
{
|
||||
s->keystr = keystring;
|
||||
s->meta = (keystring[0] == 'M' && keystring[2] != '\xE2');
|
||||
|
||||
assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2));
|
||||
s->meta = (keystring[0] == 'M' && keycode == 0);
|
||||
|
||||
if (keycode)
|
||||
s->keycode = keycode;
|
||||
@@ -462,6 +476,10 @@ int keycode_from_string(const char *keystring)
|
||||
if (keystring[0] == '^') {
|
||||
if (strcasecmp(keystring, "^Space") == 0)
|
||||
return 0;
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
|
||||
if (strcasecmp(keystring, "^H") == 0)
|
||||
return KEY_BACKSPACE;
|
||||
#endif
|
||||
if (keystring[1] <= '_' && strlen(keystring) == 2)
|
||||
return keystring[1] - 64;
|
||||
else
|
||||
@@ -556,6 +574,7 @@ void shortcut_init(void)
|
||||
const char *mark_gist = N_("Mark text starting from the cursor position");
|
||||
const char *copy_gist =
|
||||
N_("Copy current line (or marked region) and store it in cutbuffer");
|
||||
const char *zap_gist = N_("Throw away the current line (or marked region)");
|
||||
const char *indent_gist = N_("Indent the current line (or marked lines)");
|
||||
const char *unindent_gist = N_("Unindent the current line (or marked lines)");
|
||||
const char *undo_gist = N_("Undo the last operation");
|
||||
@@ -582,7 +601,7 @@ void shortcut_init(void)
|
||||
#ifndef NANO_TINY
|
||||
const char *bracket_gist = N_("Go to the matching bracket");
|
||||
#endif
|
||||
#ifdef ENABLE_HELP
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
const char *scrollup_gist =
|
||||
N_("Scroll up one line without moving the cursor textually");
|
||||
const char *scrolldown_gist =
|
||||
@@ -639,9 +658,9 @@ void shortcut_init(void)
|
||||
const char *regexp_gist =
|
||||
N_("Toggle the use of regular expressions");
|
||||
#ifdef ENABLE_HISTORIES
|
||||
const char *prevhistory_gist =
|
||||
const char *older_gist =
|
||||
N_("Recall the previous search/replace string");
|
||||
const char *nexthistory_gist =
|
||||
const char *newer_gist =
|
||||
N_("Recall the next search/replace string");
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
@@ -715,11 +734,7 @@ void shortcut_init(void)
|
||||
N_("Read File"), WITHORSANS(readfile_gist), BLANKAFTER,
|
||||
/* We allow inserting files in view mode if multibuffer mode
|
||||
* is switched on, so that we can view multiple files. */
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
VIEW);
|
||||
#else
|
||||
NOVIEW);
|
||||
#endif
|
||||
CAN_OPEN_OTHER_BUFFER);
|
||||
} else {
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
add_to_funcs(do_justify_void, MMAIN,
|
||||
@@ -761,14 +776,9 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_justify_void, MMAIN,
|
||||
N_("Justify"), WITHORSANS(justify_gist), TOGETHER, NOVIEW);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SPELLER
|
||||
add_to_funcs(do_spell, MMAIN,
|
||||
N_("To Spell"), WITHORSANS(spell_gist), TOGETHER, NOVIEW);
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
add_to_funcs(do_linter, MMAIN,
|
||||
N_("To Linter"), WITHORSANS(lint_gist), TOGETHER, NOVIEW);
|
||||
N_("To Spell"), WITHORSANS(spell_gist), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -808,6 +818,12 @@ void shortcut_init(void)
|
||||
add_to_funcs(flip_replace, MREPLACE,
|
||||
N_("No Replace"), WITHORSANS(whereis_gist), BLANKAFTER, VIEW);
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
add_to_funcs(get_history_older_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
|
||||
N_("Older"), WITHORSANS(older_gist), TOGETHER, VIEW);
|
||||
add_to_funcs(get_history_newer_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
|
||||
N_("Newer"), WITHORSANS(newer_gist), BLANKAFTER, VIEW);
|
||||
#endif
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
add_to_funcs(do_full_justify, MWHEREIS,
|
||||
N_("FullJstify"), WITHORSANS(fulljustify_gist), TOGETHER, NOVIEW);
|
||||
@@ -835,6 +851,7 @@ void shortcut_init(void)
|
||||
/* TRANSLATORS: This starts a backward search. */
|
||||
N_("Where Was"), WITHORSANS(wherewas_gist), TOGETHER, VIEW);
|
||||
add_to_funcs(do_findprevious, MMAIN|MHELP|MBROWSER,
|
||||
/* TRANSLATORS: This refers to searching the preceding occurrence. */
|
||||
N_("Previous"), WITHORSANS(findprev_gist), TOGETHER, VIEW);
|
||||
add_to_funcs(do_findnext, MMAIN|MHELP|MBROWSER,
|
||||
N_("Next"), WITHORSANS(findnext_gist), BLANKAFTER, VIEW);
|
||||
@@ -865,7 +882,7 @@ void shortcut_init(void)
|
||||
N_("Prev Line"), WITHORSANS(prevline_gist), TOGETHER, VIEW);
|
||||
add_to_funcs(do_down, MMAIN|MHELP|MBROWSER,
|
||||
N_("Next Line"), WITHORSANS(nextline_gist), TOGETHER, VIEW);
|
||||
#ifdef ENABLE_HELP
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
add_to_funcs(do_scroll_up, MMAIN,
|
||||
N_("Scroll Up"), WITHORSANS(scrollup_gist), TOGETHER, VIEW);
|
||||
add_to_funcs(do_scroll_down, MMAIN,
|
||||
@@ -911,10 +928,10 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_enter, MMAIN,
|
||||
N_("Enter"), WITHORSANS(enter_gist), BLANKAFTER, NOVIEW);
|
||||
|
||||
add_to_funcs(do_delete, MMAIN,
|
||||
N_("Delete"), WITHORSANS(delete_gist), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_backspace, MMAIN,
|
||||
N_("Backspace"), WITHORSANS(backspace_gist),
|
||||
N_("Backspace"), WITHORSANS(backspace_gist), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_delete, MMAIN,
|
||||
N_("Delete"), WITHORSANS(delete_gist),
|
||||
#ifndef NANO_TINY
|
||||
TOGETHER,
|
||||
#else
|
||||
@@ -971,15 +988,17 @@ void shortcut_init(void)
|
||||
add_to_funcs(run_macro, MMAIN,
|
||||
N_("Run Macro"), WITHORSANS(runmacro_gist), BLANKAFTER, VIEW);
|
||||
|
||||
add_to_funcs(zap_text, MMAIN,
|
||||
N_("Zap Text"), WITHORSANS(zap_gist), BLANKAFTER, NOVIEW);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_funcs(do_linter, MMAIN,
|
||||
N_("To Linter"), WITHORSANS(lint_gist), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
add_to_funcs(do_savefile, MMAIN,
|
||||
N_("Save"), WITHORSANS(savefile_gist), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
#ifdef ENABLE_HISTORIES
|
||||
add_to_funcs(get_history_older_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
|
||||
N_("PrevHstory"), WITHORSANS(prevhistory_gist), TOGETHER, VIEW);
|
||||
add_to_funcs(get_history_newer_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
|
||||
N_("NextHstory"), WITHORSANS(nexthistory_gist), BLANKAFTER, VIEW);
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_JUSTIFY
|
||||
add_to_funcs(flip_goto, MWHEREIS,
|
||||
@@ -1040,7 +1059,7 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_page_up, MBROWSER,
|
||||
N_("Prev Page"), WITHORSANS(prevpage_gist), TOGETHER, VIEW);
|
||||
add_to_funcs(do_page_down, MBROWSER,
|
||||
N_("Prev Page"), WITHORSANS(nextpage_gist), TOGETHER, VIEW);
|
||||
N_("Next Page"), WITHORSANS(nextpage_gist), TOGETHER, VIEW);
|
||||
|
||||
add_to_funcs(to_first_file, MBROWSER|MWHEREISFILE,
|
||||
N_("First File"), WITHORSANS(firstfile_gist), TOGETHER, VIEW);
|
||||
@@ -1070,59 +1089,50 @@ void shortcut_init(void)
|
||||
#endif
|
||||
|
||||
/* Link key combos to functions in certain menus. */
|
||||
add_to_sclist(MMOST, "^M", 0, do_enter, 0);
|
||||
add_to_sclist(MMOST, "Enter", KEY_ENTER, do_enter, 0);
|
||||
add_to_sclist(MMOST|MBROWSER, "^M", 0, do_enter, 0);
|
||||
add_to_sclist(MMOST|MBROWSER, "Enter", KEY_ENTER, do_enter, 0);
|
||||
add_to_sclist(MMOST, "^H", 0, do_backspace, 0);
|
||||
add_to_sclist(MMOST, "Bsp", KEY_BACKSPACE, do_backspace, 0);
|
||||
add_to_sclist(MMOST, "Sh-Del", SHIFT_DELETE, do_backspace, 0);
|
||||
add_to_sclist(MMOST, "^D", 0, do_delete, 0);
|
||||
add_to_sclist(MMOST, "Del", 0, do_delete, 0);
|
||||
/* Make ASCII DEL do a delete when requested, otherwise a backspace. */
|
||||
if (ISSET(REBIND_DELETE))
|
||||
add_to_sclist(MMOST, "Del", DEL_CODE, do_delete, 0);
|
||||
else
|
||||
add_to_sclist(MMOST & ~MBROWSER, "Bsp", DEL_CODE, do_backspace, 0);
|
||||
add_to_sclist(MMOST, "^I", 0, do_tab, 0);
|
||||
add_to_sclist(MMOST, "Tab", TAB_CODE, do_tab, 0);
|
||||
add_to_sclist(MMOST & ~MFINDINHELP, "^G", 0, do_help_void, 0);
|
||||
add_to_sclist(MMOST & ~MFINDINHELP, "F1", 0, do_help_void, 0);
|
||||
add_to_sclist((MMOST|MBROWSER) & ~MFINDINHELP, "^G", 0, do_help_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", 0, do_exit, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", 0, do_exit, 0);
|
||||
add_to_sclist(MMAIN, "^S", 0, do_savefile, 0);
|
||||
add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0);
|
||||
add_to_sclist(MMAIN, "F3", 0, do_writeout_void, 0);
|
||||
add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0);
|
||||
add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0);
|
||||
add_to_sclist(MMAIN, "Ins", 0, do_insertfile_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^Q", 0, do_search_backward, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^W", 0, do_search_forward, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F6", 0, do_search_forward, 0);
|
||||
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
|
||||
add_to_sclist(MMAIN, "M-R", 0, do_replace, 0);
|
||||
add_to_sclist(MMAIN, "F14", 0, do_replace, 0);
|
||||
add_to_sclist(MMOST, "^K", 0, do_cut_text_void, 0);
|
||||
add_to_sclist(MMOST, "F9", 0, do_cut_text_void, 0);
|
||||
add_to_sclist(MMOST, "^U", 0, do_uncut_text, 0);
|
||||
add_to_sclist(MMOST, "F10", 0, do_uncut_text, 0);
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
add_to_sclist(MMAIN, "^J", 0, do_justify_void, 0);
|
||||
add_to_sclist(MMAIN, "F4", 0, do_justify_void, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_SPELLER
|
||||
add_to_sclist(MMAIN, "^T", 0, do_spell, 0);
|
||||
add_to_sclist(MMAIN, "F12", 0, do_spell, 0);
|
||||
#else
|
||||
#ifdef ENABLE_COLOR
|
||||
add_to_sclist(MMAIN, "^T", 0, do_linter, 0);
|
||||
add_to_sclist(MMAIN, "F12", 0, do_linter, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
add_to_sclist(MMAIN, "M-B", 0, do_linter, 0);
|
||||
#endif
|
||||
add_to_sclist(MMAIN, "^C", 0, do_cursorpos_void, 0);
|
||||
add_to_sclist(MMAIN, "F11", 0, do_cursorpos_void, 0);
|
||||
add_to_sclist(MMAIN, "^_", 0, do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN, "M-G", 0, do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN, "F13", 0, do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", 0, do_page_up, 0);
|
||||
add_to_sclist(MHELP|MBROWSER, "Bsp", KEY_BACKSPACE, do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", 0, do_page_up, 0);
|
||||
add_to_sclist(MHELP|MBROWSER, "Sh-Del", SHIFT_DELETE, do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", KEY_PPAGE, do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", 0, do_page_down, 0);
|
||||
add_to_sclist(MHELP|MBROWSER, "Space", 0x20, do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", KEY_NPAGE, do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-\\", 0, to_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "^Home", CONTROL_HOME, to_first_line, 0);
|
||||
@@ -1135,7 +1145,6 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-A", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "^6", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "^^", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "F15", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "M-6", 0, do_copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-}", 0, do_indent, 0);
|
||||
@@ -1146,8 +1155,9 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-;", 0, run_macro, 0);
|
||||
add_to_sclist(MMAIN, "M-U", 0, do_undo, 0);
|
||||
add_to_sclist(MMAIN, "M-E", 0, do_redo, 0);
|
||||
add_to_sclist(MMAIN, "M-|", 0, do_cut_prev_word, 0);
|
||||
add_to_sclist(MMAIN, "Sh-^Del", CONTROL_SHIFT_DELETE, do_cut_prev_word, 0);
|
||||
add_to_sclist(MMAIN, "^Del", CONTROL_DELETE, do_cut_next_word, 0);
|
||||
add_to_sclist(MMAIN, "M-Del", ALT_DELETE, zap_text, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_WORDCOMPLETION
|
||||
add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0);
|
||||
@@ -1155,51 +1165,51 @@ void shortcut_init(void)
|
||||
#ifdef ENABLE_COMMENT
|
||||
add_to_sclist(MMAIN, "M-3", 0, do_comment, 0);
|
||||
#endif
|
||||
add_to_sclist(MMOST, "^B", 0, do_left, 0);
|
||||
add_to_sclist(MMOST, "^F", 0, do_right, 0);
|
||||
add_to_sclist(MMOST|MBROWSER, "^B", 0, do_left, 0);
|
||||
add_to_sclist(MMOST|MBROWSER, "^F", 0, do_right, 0);
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MMOST, "\xE2\x97\x80", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "\xE2\x96\xb6", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MMOST|MHELP|MBROWSER, "\xE2\x97\x80", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST|MHELP|MBROWSER, "\xE2\x96\xb6", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MSOME, "^\xE2\x97\x80", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MSOME, "^\xE2\x96\xb6", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
#ifndef NANO_TINY
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
add_to_sclist(MMAIN, "M-\xE2\x97\x80", ALT_LEFT, switch_to_prev_buffer, 0);
|
||||
add_to_sclist(MMAIN, "M-\xE2\x96\xb6", ALT_RIGHT, switch_to_next_buffer, 0);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "M-\xE2\x96\xb2", ALT_UP, do_findprevious, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "M-\xE2\x96\xbc", ALT_DOWN, do_findnext, 0);
|
||||
#endif
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
add_to_sclist(MMOST, "Left", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "Right", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MMOST|MHELP|MBROWSER, "Left", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST|MHELP|MBROWSER, "Right", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MSOME, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MSOME, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
}
|
||||
add_to_sclist(MMOST, "M-Space", 0, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^Space", 0, do_next_word_void, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "^A", 0, do_home, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "Home", KEY_HOME, do_home, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "^E", 0, do_end, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "End", KEY_END, do_end, 0);
|
||||
add_to_sclist(MMOST|MBROWSER, "M-Space", 0, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST|MBROWSER, "^Space", 0, do_next_word_void, 0);
|
||||
add_to_sclist(MMOST, "^A", 0, do_home, 0);
|
||||
add_to_sclist(MMOST, "Home", KEY_HOME, do_home, 0);
|
||||
add_to_sclist(MMOST, "^E", 0, do_end, 0);
|
||||
add_to_sclist(MMOST, "End", KEY_END, do_end, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", 0, do_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", 0, do_down, 0);
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x96\xb2", KEY_UP, do_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x96\xbc", KEY_DOWN, do_down, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x96\xb2", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x96\xbc", CONTROL_DOWN, do_next_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^\xE2\x96\xb2", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^\xE2\x96\xbc", CONTROL_DOWN, do_next_block, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^Up", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^Down", CONTROL_DOWN, do_next_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^Up", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^Down", CONTROL_DOWN, do_next_block, 0);
|
||||
}
|
||||
add_to_sclist(MMAIN, "M-7", 0, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN, "M-8", 0, do_next_block, 0);
|
||||
@@ -1209,7 +1219,7 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-)", 0, do_para_end_void, 0);
|
||||
add_to_sclist(MMAIN, "M-0", 0, do_para_end_void, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_HELP
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
add_to_sclist(MMAIN, "M--", 0, do_scroll_up, 0);
|
||||
add_to_sclist(MMAIN, "M-_", 0, do_scroll_up, 0);
|
||||
add_to_sclist(MMAIN, "M-+", 0, do_scroll_down, 0);
|
||||
@@ -1262,7 +1272,7 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-Z", 0, do_toggle_void, SUSPEND);
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
add_to_sclist(((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), "^C", 0, do_cancel, 0);
|
||||
add_to_sclist(((MMOST & ~MMAIN) | MYESNO), "^C", 0, do_cancel, 0);
|
||||
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0);
|
||||
@@ -1300,7 +1310,6 @@ void shortcut_init(void)
|
||||
add_to_sclist(MBROWSER, "^End", CONTROL_END, to_last_file, 0);
|
||||
add_to_sclist(MBROWSER, "^_", 0, goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "M-G", 0, goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "F13", 0, goto_dir_void, 0);
|
||||
#endif
|
||||
if (ISSET(TEMP_FILE))
|
||||
add_to_sclist(MWRITEFILE, "^Q", 0, discard_buffer, 0);
|
||||
@@ -1343,32 +1352,31 @@ void shortcut_init(void)
|
||||
add_to_sclist(MHELP, "Home", KEY_HOME, to_first_line, 0);
|
||||
add_to_sclist(MHELP, "End", KEY_END, to_last_line, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
add_to_sclist(MLINTER, "^X", 0, do_cancel, 0);
|
||||
#endif
|
||||
add_to_sclist(MMOST & ~MFINDINHELP, "F1", 0, do_help_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", 0, do_exit, 0);
|
||||
add_to_sclist(MMAIN, "F3", 0, do_writeout_void, 0);
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
add_to_sclist(MMAIN, "F4", 0, do_justify_void, 0);
|
||||
#endif
|
||||
add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F6", 0, do_search_forward, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", 0, do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0);
|
||||
add_to_sclist(MMOST, "F9", 0, do_cut_text_void, 0);
|
||||
add_to_sclist(MMOST, "F10", 0, do_uncut_text, 0);
|
||||
add_to_sclist(MMAIN, "F11", 0, do_cursorpos_void, 0);
|
||||
#ifdef ENABLE_SPELLER
|
||||
add_to_sclist(MMAIN, "F12", 0, do_spell, 0);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
print_sclist();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(ENABLE_COLOR) && defined(ENABLE_SPELLER)
|
||||
/* Assign one function's shortcuts to another function. */
|
||||
void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
|
||||
{
|
||||
for (sc *s = sclist; s != NULL; s = s->next)
|
||||
if (s->func == oldfunc)
|
||||
s->func = newfunc;
|
||||
}
|
||||
|
||||
void set_linter_shortcut(void)
|
||||
{
|
||||
replace_scs_for(do_spell, do_linter);
|
||||
}
|
||||
|
||||
void set_speller_shortcut(void)
|
||||
{
|
||||
replace_scs_for(do_linter, do_spell);
|
||||
}
|
||||
#endif /* ENABLE_COLOR && ENABLE_SPELLER */
|
||||
|
||||
const subnfunc *sctofunc(const sc *s)
|
||||
{
|
||||
subnfunc *f = allfuncs;
|
||||
@@ -1469,6 +1477,8 @@ sc *strtosc(const char *input)
|
||||
else if (!strcasecmp(input, "copy") ||
|
||||
!strcasecmp(input, "copytext")) /* Deprecated. Remove end of 2018. */
|
||||
s->func = do_copy_text;
|
||||
else if (!strcasecmp(input, "zap"))
|
||||
s->func = zap_text;
|
||||
else if (!strcasecmp(input, "mark"))
|
||||
s->func = do_mark;
|
||||
#endif
|
||||
@@ -1537,7 +1547,7 @@ sc *strtosc(const char *input)
|
||||
else if (!strcasecmp(input, "down") ||
|
||||
!strcasecmp(input, "nextline"))
|
||||
s->func = do_down;
|
||||
#ifdef ENABLE_HELP
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
else if (!strcasecmp(input, "scrollup"))
|
||||
s->func = do_scroll_up;
|
||||
else if (!strcasecmp(input, "scrolldown"))
|
||||
@@ -1597,9 +1607,9 @@ sc *strtosc(const char *input)
|
||||
!strcasecmp(input, "gototext")) /* Deprecated. Remove end of 2018. */
|
||||
s->func = flip_goto;
|
||||
#ifdef ENABLE_HISTORIES
|
||||
else if (!strcasecmp(input, "prevhistory"))
|
||||
else if (!strcasecmp(input, "older"))
|
||||
s->func = get_history_older_void;
|
||||
else if (!strcasecmp(input, "nexthistory"))
|
||||
else if (!strcasecmp(input, "newer"))
|
||||
s->func = get_history_newer_void;
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
|
||||
62
src/help.c
62
src/help.c
@@ -183,37 +183,29 @@ void do_help(void)
|
||||
focusing = TRUE;
|
||||
|
||||
/* Show the cursor when we searched and found something. */
|
||||
kbinput = get_kbinput(edit, didfind == 1);
|
||||
kbinput = get_kbinput(edit, didfind == 1 || ISSET(SHOW_CURSOR));
|
||||
didfind = 0;
|
||||
|
||||
func = parse_help_input(&kbinput);
|
||||
|
||||
if (func == total_refresh) {
|
||||
total_redraw();
|
||||
} else if (ISSET(SHOW_CURSOR) && (func == do_left || func == do_right ||
|
||||
func == do_up || func == do_down)) {
|
||||
func();
|
||||
} else if (func == do_up) {
|
||||
do_scroll_up();
|
||||
} else if (func == do_down) {
|
||||
if (openfile->edittop->lineno + editwinrows - 1 <
|
||||
openfile->filebot->lineno)
|
||||
do_scroll_down();
|
||||
} else if (func == do_page_up) {
|
||||
do_page_up();
|
||||
} else if (func == do_page_down) {
|
||||
do_page_down();
|
||||
} else if (func == to_first_line) {
|
||||
to_first_line();
|
||||
} else if (func == to_last_line) {
|
||||
to_last_line();
|
||||
} else if (func == do_search_forward) {
|
||||
do_search_forward();
|
||||
} else if (func == do_page_up || func == do_page_down ||
|
||||
func == to_first_line || func == to_last_line ||
|
||||
func == do_findprevious || func == do_findnext) {
|
||||
func();
|
||||
} else if (func == do_search_forward || func == do_search_backward) {
|
||||
func();
|
||||
bottombars(MHELP);
|
||||
} else if (func == do_search_backward) {
|
||||
do_search_backward();
|
||||
bottombars(MHELP);
|
||||
} else if (func == do_findprevious) {
|
||||
do_findprevious();
|
||||
} else if (func == do_findnext) {
|
||||
do_findnext();
|
||||
#ifdef ENABLE_NANORC
|
||||
} else if (func == (functionptrtype)implant) {
|
||||
implant(first_sc_for(MHELP, func)->expansion);
|
||||
@@ -421,6 +413,15 @@ void help_init(void)
|
||||
"command.\n\n");
|
||||
htx[2] = N_(" The following function keys are "
|
||||
"available in Execute Command mode:\n\n");
|
||||
} else if (currmenu == MLINTER) {
|
||||
htx[0] = N_("=== Linter ===\n\n "
|
||||
"In this mode, the status bar shows an error message or "
|
||||
"warning, and the cursor is put at the corresponding "
|
||||
"position in the file. With PageUp and PageDown you "
|
||||
"can switch to earlier and later messages.\n\n");
|
||||
htx[1] = N_(" The following function keys are "
|
||||
"available in Linter mode:\n\n");
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
else {
|
||||
@@ -499,28 +500,20 @@ void help_init(void)
|
||||
|
||||
/* Now add our shortcut info. */
|
||||
for (f = allfuncs; f != NULL; f = f->next) {
|
||||
int scsfound = 0;
|
||||
int tally = 0;
|
||||
|
||||
if ((f->menus & currmenu) == 0)
|
||||
continue;
|
||||
|
||||
/* Let's simply show the first two shortcuts from the list. */
|
||||
for (s = sclist; s != NULL; s = s->next) {
|
||||
|
||||
if ((s->menus & currmenu) == 0)
|
||||
continue;
|
||||
|
||||
if (s->func == f->func) {
|
||||
scsfound++;
|
||||
if ((s->menus & currmenu) && s->func == f->func) {
|
||||
/* Make the first column narrower (6) than the second (10),
|
||||
* but allow it to spill into the second, for "M-Space". */
|
||||
if (scsfound == 1) {
|
||||
if (++tally == 1) {
|
||||
sprintf(ptr, "%s ", s->keystr);
|
||||
/* Unicode arrows take three bytes instead of one. */
|
||||
if (strstr(s->keystr, "\xE2") != NULL)
|
||||
ptr += 8;
|
||||
else
|
||||
ptr += 6;
|
||||
ptr += (strstr(s->keystr, "\xE2") != NULL ? 8 : 6);
|
||||
} else {
|
||||
ptr += sprintf(ptr, "(%s)\t", s->keystr);
|
||||
break;
|
||||
@@ -528,9 +521,9 @@ void help_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (scsfound == 0)
|
||||
if (tally == 0)
|
||||
ptr += sprintf(ptr, "\t\t");
|
||||
else if (scsfound == 1)
|
||||
else if (tally == 1)
|
||||
ptr += 10;
|
||||
|
||||
/* The shortcut's help text. */
|
||||
@@ -574,10 +567,11 @@ functionptrtype parse_help_input(int *kbinput)
|
||||
{
|
||||
if (!meta_key) {
|
||||
switch (*kbinput) {
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case DEL_CODE:
|
||||
case '-':
|
||||
return do_page_up;
|
||||
case ' ':
|
||||
return do_page_down;
|
||||
case 'W':
|
||||
case 'w':
|
||||
case '/':
|
||||
|
||||
@@ -403,7 +403,7 @@ void load_poshistory(void)
|
||||
if (hisfile == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
/* When reading failed, don't save history when we quit. */
|
||||
UNSET(POS_HISTORY);
|
||||
UNSET(POSITIONLOG);
|
||||
history_error(N_("Error reading %s: %s"), poshistname, strerror(errno));
|
||||
}
|
||||
} else {
|
||||
|
||||
71
src/move.c
71
src/move.c
@@ -170,12 +170,10 @@ void do_page_down(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
/* Move to the beginning of the last beginning-of-paragraph line before the
|
||||
* current line. If update_screen is TRUE, update the screen afterwards. */
|
||||
void do_para_begin(bool update_screen)
|
||||
/* Move to the beginning of the first-found beginning-of-paragraph line
|
||||
* before the current line. */
|
||||
void do_para_begin(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
|
||||
if (openfile->current != openfile->fileage)
|
||||
openfile->current = openfile->current->prev;
|
||||
|
||||
@@ -183,21 +181,15 @@ void do_para_begin(bool update_screen)
|
||||
openfile->current = openfile->current->prev;
|
||||
|
||||
openfile->current_x = 0;
|
||||
|
||||
if (update_screen)
|
||||
edit_redraw(was_current, CENTERING);
|
||||
}
|
||||
|
||||
/* Move down to the beginning of the last line of the current paragraph.
|
||||
* Then move down one line farther if there is such a line, or to the
|
||||
* end of the current line if not. If update_screen is TRUE, update the
|
||||
* screen afterwards. A line is the last line of a paragraph if it is
|
||||
* in a paragraph, and the next line either is the beginning line of a
|
||||
* paragraph or isn't in a paragraph. */
|
||||
void do_para_end(bool update_screen)
|
||||
* end of the current line if not. A line is the last line of a paragraph
|
||||
* if it is in a paragraph, and the next line either is the beginning line
|
||||
* of a paragraph or isn't in a paragraph. */
|
||||
void do_para_end(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
|
||||
while (openfile->current != openfile->filebot &&
|
||||
!inpar(openfile->current))
|
||||
openfile->current = openfile->current->next;
|
||||
@@ -213,21 +205,26 @@ void do_para_end(bool update_screen)
|
||||
openfile->current_x = 0;
|
||||
} else
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
|
||||
if (update_screen)
|
||||
edit_redraw(was_current, CENTERING);
|
||||
}
|
||||
|
||||
/* Move up to first start of a paragraph before the current line. */
|
||||
void do_para_begin_void(void)
|
||||
{
|
||||
do_para_begin(TRUE);
|
||||
filestruct *was_current = openfile->current;
|
||||
|
||||
do_para_begin();
|
||||
|
||||
edit_redraw(was_current, CENTERING);
|
||||
}
|
||||
|
||||
/* Move down to just after the first end of a paragraph. */
|
||||
void do_para_end_void(void)
|
||||
{
|
||||
do_para_end(TRUE);
|
||||
filestruct *was_current = openfile->current;
|
||||
|
||||
do_para_end();
|
||||
|
||||
edit_redraw(was_current, CENTERING);
|
||||
}
|
||||
#endif /* ENABLE_JUSTIFY */
|
||||
|
||||
@@ -272,10 +269,9 @@ void do_next_block(void)
|
||||
}
|
||||
|
||||
/* Move to the previous word. If allow_punct is TRUE, treat punctuation
|
||||
* as part of a word. When requested, update the screen afterwards. */
|
||||
void do_prev_word(bool allow_punct, bool update_screen)
|
||||
* as part of a word. */
|
||||
void do_prev_word(bool allow_punct)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||
|
||||
/* Move backward until we pass over the start of a word. */
|
||||
@@ -309,18 +305,13 @@ void do_prev_word(bool allow_punct, bool update_screen)
|
||||
/* Move one character forward again to sit on the start of the word. */
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
if (update_screen)
|
||||
edit_redraw(was_current, FLOWING);
|
||||
}
|
||||
|
||||
/* Move to the next word. If after_ends is TRUE, stop at the ends of words
|
||||
* instead of their beginnings. If allow_punct is TRUE, treat punctuation
|
||||
* as part of a word. When requested, update the screen afterwards.
|
||||
* Return TRUE if we started on a word, and FALSE otherwise. */
|
||||
bool do_next_word(bool after_ends, bool allow_punct, bool update_screen)
|
||||
* instead of their beginnings. If allow_punct is TRUE, treat punctuation as
|
||||
* part of a word. Return TRUE if we started on a word, and FALSE otherwise. */
|
||||
bool do_next_word(bool after_ends, bool allow_punct)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
bool started_on_word = is_word_mbchar(openfile->current->data +
|
||||
openfile->current_x, allow_punct);
|
||||
bool seen_space = !started_on_word;
|
||||
@@ -366,10 +357,6 @@ bool do_next_word(bool after_ends, bool allow_punct, bool update_screen)
|
||||
}
|
||||
}
|
||||
|
||||
if (update_screen)
|
||||
edit_redraw(was_current, FLOWING);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
return started_on_word;
|
||||
}
|
||||
|
||||
@@ -377,7 +364,11 @@ bool do_next_word(bool after_ends, bool allow_punct, bool update_screen)
|
||||
* word if the WORD_BOUNDS flag is set, and update the screen afterwards. */
|
||||
void do_prev_word_void(void)
|
||||
{
|
||||
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
|
||||
filestruct *was_current = openfile->current;
|
||||
|
||||
do_prev_word(ISSET(WORD_BOUNDS));
|
||||
|
||||
edit_redraw(was_current, FLOWING);
|
||||
}
|
||||
|
||||
/* Move to the next word in the file. If the AFTER_ENDS flag is set, stop
|
||||
@@ -385,7 +376,11 @@ void do_prev_word_void(void)
|
||||
* punctuation as part of a word. Update the screen afterwards. */
|
||||
void do_next_word_void(void)
|
||||
{
|
||||
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS), TRUE);
|
||||
filestruct *was_current = openfile->current;
|
||||
|
||||
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS));
|
||||
|
||||
edit_redraw(was_current, FLOWING);
|
||||
}
|
||||
|
||||
/* Move to the beginning of the current line (or softwrapped chunk).
|
||||
@@ -545,7 +540,7 @@ void do_down(void)
|
||||
openfile->placewewant = leftedge + target_column;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_HELP
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
/* Scroll up one line or chunk without scrolling the cursor. */
|
||||
void do_scroll_up(void)
|
||||
{
|
||||
|
||||
194
src/nano.c
194
src/nano.c
@@ -502,12 +502,6 @@ void copy_from_buffer(filestruct *somebuffer)
|
||||
ingraft_buffer(the_copy);
|
||||
}
|
||||
|
||||
/* Create a new openfile node. */
|
||||
openfilestruct *make_new_opennode(void)
|
||||
{
|
||||
return (openfilestruct *)nmalloc(sizeof(openfilestruct));
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Unlink a node from the rest of the circular list, and delete it. */
|
||||
void unlink_opennode(openfilestruct *fileptr)
|
||||
@@ -584,7 +578,7 @@ void finish(void)
|
||||
/* If the user wants history persistence, write the relevant files. */
|
||||
if (ISSET(HISTORYLOG))
|
||||
save_history();
|
||||
if (ISSET(POS_HISTORY)) {
|
||||
if (ISSET(POSITIONLOG)) {
|
||||
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs() + 1);
|
||||
}
|
||||
#endif
|
||||
@@ -721,6 +715,7 @@ void window_init(void)
|
||||
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
/* Set up the wrapping point, accounting for screen width when negative. */
|
||||
fill = wrap_at;
|
||||
if (fill <= 0)
|
||||
fill += COLS;
|
||||
if (fill < 0)
|
||||
@@ -805,8 +800,7 @@ void usage(void)
|
||||
N_("Log & read search/replace string history"));
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!ISSET(RESTRICTED))
|
||||
print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files"));
|
||||
print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files"));
|
||||
#endif
|
||||
print_opt("-K", "--rebindkeypad",
|
||||
N_("Fix numeric keypad key confusion problem"));
|
||||
@@ -851,6 +845,7 @@ void usage(void)
|
||||
N_("Syntax definition to use for coloring"));
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-Z", "--zap", N_("Let Bsp and Del erase a marked region"));
|
||||
print_opt("-a", "--atblanks", N_("When soft-wrapping, do it at whitespace"));
|
||||
#endif
|
||||
print_opt("-c", "--constantshow", N_("Constantly show cursor position"));
|
||||
@@ -858,7 +853,7 @@ void usage(void)
|
||||
N_("Fix Backspace/Delete confusion problem"));
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (!ISSET(RESTRICTED))
|
||||
print_opt("-g", "--showcursor", N_("Show cursor in file browser"));
|
||||
print_opt("-g", "--showcursor", N_("Show cursor in file browser & help text"));
|
||||
#endif
|
||||
print_opt("-h", "--help", N_("Show this help text and exit"));
|
||||
#ifndef NANO_TINY
|
||||
@@ -1263,6 +1258,9 @@ RETSIGTYPE do_suspend(int signal)
|
||||
/* Restore the old terminal settings. */
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
|
||||
/* The suspend keystroke must not elicit cursor-position display. */
|
||||
suppress_cursorpos=TRUE;
|
||||
|
||||
#ifdef SIGSTOP
|
||||
/* Do what mutt does: send ourselves a SIGSTOP. */
|
||||
kill(0, SIGSTOP);
|
||||
@@ -1361,24 +1359,12 @@ void regenerate_screen(void)
|
||||
total_refresh();
|
||||
}
|
||||
|
||||
/* If allow is FALSE, block any SIGWINCH signal. If allow is TRUE,
|
||||
* unblock SIGWINCH so any pending ones can be dealt with. */
|
||||
void allow_sigwinch(bool allow)
|
||||
{
|
||||
sigset_t winch;
|
||||
|
||||
sigemptyset(&winch);
|
||||
sigaddset(&winch, SIGWINCH);
|
||||
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
|
||||
}
|
||||
|
||||
/* Handle the global toggle specified in flag. */
|
||||
void do_toggle(int flag)
|
||||
{
|
||||
bool enabled;
|
||||
|
||||
if (ISSET(RESTRICTED) && (flag == SUSPEND || flag == MULTIBUFFER ||
|
||||
flag == BACKUP_FILE || flag == NO_COLOR_SYNTAX)) {
|
||||
if (flag == SUSPEND && ISSET(RESTRICTED)) {
|
||||
show_restricted_warning();
|
||||
return;
|
||||
}
|
||||
@@ -1540,9 +1526,12 @@ int get_keycode(const char *keyname, const int standard)
|
||||
|
||||
if (keyvalue != 0 && keyvalue != (char *)-1 && key_defined(keyvalue))
|
||||
return key_defined(keyvalue);
|
||||
else
|
||||
#endif
|
||||
return standard;
|
||||
#ifdef DEBUG
|
||||
if (!ISSET(REBIND_KEYPAD))
|
||||
fprintf(stderr, "Using fallback keycode for %s\n", keyname);
|
||||
#endif
|
||||
return standard;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
@@ -1654,12 +1643,12 @@ bool wanted_to_move(void (*func)(void))
|
||||
func == to_first_line || func == to_last_line;
|
||||
}
|
||||
|
||||
/* Return TRUE when the given shortcut is valid in view mode. */
|
||||
/* Return TRUE when the given shortcut is admissible in view mode. */
|
||||
bool okay_for_view(const sc *shortcut)
|
||||
{
|
||||
const subnfunc *func = sctofunc(shortcut);
|
||||
|
||||
return (func != NULL && func->viewok);
|
||||
return (func == NULL || func->viewok);
|
||||
}
|
||||
|
||||
/* Read in a keystroke. Act on the keystroke if it is a shortcut or a toggle;
|
||||
@@ -1889,7 +1878,12 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
set_modified();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(ADD);
|
||||
/* Only add a new undo item when the current item is not an ADD or when
|
||||
* the current typing is not contiguous with the previous typing. */
|
||||
if (openfile->last_action != ADD || openfile->current_undo == NULL ||
|
||||
openfile->current_undo->mark_begin_lineno != openfile->current->lineno ||
|
||||
openfile->current_undo->mark_begin_x != openfile->current_x)
|
||||
add_undo(ADD);
|
||||
|
||||
/* Note that current_x has not yet been incremented. */
|
||||
if (openfile->current == openfile->mark &&
|
||||
@@ -2027,6 +2021,7 @@ int main(int argc, char **argv)
|
||||
{"smooth", 0, NULL, 'S'},
|
||||
{"wordbounds", 0, NULL, 'W'},
|
||||
{"wordchars", 1, NULL, 'X'},
|
||||
{"zap", 0, NULL, 'Z'},
|
||||
{"atblanks", 0, NULL, 'a'},
|
||||
{"autoindent", 0, NULL, 'i'},
|
||||
{"cutfromcursor", 0, NULL, 'k'},
|
||||
@@ -2090,7 +2085,7 @@ int main(int argc, char **argv)
|
||||
|
||||
while ((optchr =
|
||||
getopt_long(argc, argv,
|
||||
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxyz$",
|
||||
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:Zabcdefghijklmno:pqr:s:tuvwxyz$",
|
||||
long_options, NULL)) != -1) {
|
||||
switch (optchr) {
|
||||
#ifndef NANO_TINY
|
||||
@@ -2153,7 +2148,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
#ifdef ENABLE_HISTORIES
|
||||
case 'P':
|
||||
SET(POS_HISTORY);
|
||||
SET(POSITIONLOG);
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
@@ -2196,6 +2191,9 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
case 'Z':
|
||||
SET(LET_THEM_ZAP);
|
||||
break;
|
||||
case 'a':
|
||||
SET(AT_BLANKS);
|
||||
break;
|
||||
@@ -2247,7 +2245,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
case 'r':
|
||||
if (!parse_num(optarg, &fill)) {
|
||||
if (!parse_num(optarg, &wrap_at)) {
|
||||
fprintf(stderr, _("Requested fill size \"%s\" is invalid"), optarg);
|
||||
fprintf(stderr, "\n");
|
||||
exit(1);
|
||||
@@ -2311,55 +2309,42 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're using restricted mode, disable suspending, backups,
|
||||
* rcfiles, and history files, since they all would allow reading
|
||||
* from or writing to files not specified on the command line. */
|
||||
if (ISSET(RESTRICTED)) {
|
||||
UNSET(SUSPEND);
|
||||
UNSET(BACKUP_FILE);
|
||||
#ifdef ENABLE_NANORC
|
||||
no_rcfiles = TRUE;
|
||||
UNSET(HISTORYLOG);
|
||||
UNSET(POS_HISTORY);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Set up the function and shortcut lists. This needs to be done
|
||||
* before reading the rcfile, to be able to rebind/unbind keys. */
|
||||
shortcut_init();
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!no_rcfiles) {
|
||||
/* Back up the command-line options, then read the rcfile(s). */
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
char *operating_dir_cpy = operating_dir;
|
||||
#endif
|
||||
/* Back up the command-line options, then clear the strings. */
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
ssize_t fill_cpy = fill;
|
||||
ssize_t wrap_at_cmdline = wrap_at;
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
char *backup_dir_cpy = backup_dir;
|
||||
char *word_chars_cpy = word_chars;
|
||||
char *backup_dir_cmdline = backup_dir;
|
||||
char *word_chars_cmdline = word_chars;
|
||||
#endif
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
char *operating_dir_cmdline = operating_dir;
|
||||
#endif
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
char *quotestr_cpy = quotestr;
|
||||
char *quotestr_cmdline = quotestr;
|
||||
#endif
|
||||
#ifdef ENABLE_SPELLER
|
||||
char *alt_speller_cpy = alt_speller;
|
||||
char *alt_speller_cmdline = alt_speller;
|
||||
#endif
|
||||
ssize_t tabsize_cpy = tabsize;
|
||||
unsigned flags_cpy[sizeof(flags) / sizeof(flags[0])];
|
||||
ssize_t tabsize_cmdline = tabsize;
|
||||
unsigned flags_cmdline[sizeof(flags) / sizeof(flags[0])];
|
||||
size_t i;
|
||||
|
||||
memcpy(flags_cpy, flags, sizeof(flags_cpy));
|
||||
memcpy(flags_cmdline, flags, sizeof(flags_cmdline));
|
||||
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
operating_dir = NULL;
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
backup_dir = NULL;
|
||||
word_chars = NULL;
|
||||
#endif
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
operating_dir = NULL;
|
||||
#endif
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
quotestr = NULL;
|
||||
#endif
|
||||
@@ -2367,6 +2352,7 @@ int main(int argc, char **argv)
|
||||
alt_speller = NULL;
|
||||
#endif
|
||||
|
||||
/* Now process the system's and the user's nanorc file, if any. */
|
||||
do_rcfiles();
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -2375,44 +2361,44 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
/* If the backed-up command-line options have a value, restore them. */
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
if (operating_dir_cpy != NULL) {
|
||||
free(operating_dir);
|
||||
operating_dir = operating_dir_cpy;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
if (fill_used)
|
||||
fill = fill_cpy;
|
||||
wrap_at = wrap_at_cmdline;
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (backup_dir_cpy != NULL) {
|
||||
if (backup_dir_cmdline != NULL) {
|
||||
free(backup_dir);
|
||||
backup_dir = backup_dir_cpy;
|
||||
backup_dir = backup_dir_cmdline;
|
||||
}
|
||||
if (word_chars_cpy != NULL) {
|
||||
if (word_chars_cmdline != NULL) {
|
||||
free(word_chars);
|
||||
word_chars = word_chars_cpy;
|
||||
word_chars = word_chars_cmdline;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
if (operating_dir_cmdline != NULL || ISSET(RESTRICTED)) {
|
||||
free(operating_dir);
|
||||
operating_dir = operating_dir_cmdline;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
if (quotestr_cpy != NULL) {
|
||||
if (quotestr_cmdline != NULL) {
|
||||
free(quotestr);
|
||||
quotestr = quotestr_cpy;
|
||||
quotestr = quotestr_cmdline;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_SPELLER
|
||||
if (alt_speller_cpy != NULL) {
|
||||
if (alt_speller_cmdline != NULL) {
|
||||
free(alt_speller);
|
||||
alt_speller = alt_speller_cpy;
|
||||
alt_speller = alt_speller_cmdline;
|
||||
}
|
||||
#endif
|
||||
if (tabsize_cpy != -1)
|
||||
tabsize = tabsize_cpy;
|
||||
if (tabsize_cmdline != -1)
|
||||
tabsize = tabsize_cmdline;
|
||||
|
||||
/* Simply OR the boolean flags from rcfile and command line. */
|
||||
for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++)
|
||||
flags[i] |= flags_cpy[i];
|
||||
flags[i] |= flags_cmdline[i];
|
||||
}
|
||||
#ifdef DISABLE_ROOTWRAPPING
|
||||
/* If we don't have any rcfiles, --disable-wrapping-as-root is used,
|
||||
@@ -2433,32 +2419,41 @@ int main(int argc, char **argv)
|
||||
if (ISSET(BOLD_TEXT))
|
||||
hilite_attribute = A_BOLD;
|
||||
|
||||
/* When in restricted mode, disable backups, suspending, and history files,
|
||||
* since they allow writing to files not specified on the command line. */
|
||||
if (ISSET(RESTRICTED)) {
|
||||
UNSET(BACKUP_FILE);
|
||||
UNSET(SUSPEND);
|
||||
#ifdef ENABLE_NANORC
|
||||
UNSET(HISTORYLOG);
|
||||
UNSET(POSITIONLOG);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
/* Initialize the pointers for the Search/Replace/Execute histories. */
|
||||
history_init();
|
||||
|
||||
/* If we need history files, verify that we have a directory for them,
|
||||
* and when not, cancel the options. */
|
||||
if ((ISSET(HISTORYLOG) || ISSET(POS_HISTORY)) && !have_statedir()) {
|
||||
if ((ISSET(HISTORYLOG) || ISSET(POSITIONLOG)) && !have_statedir()) {
|
||||
UNSET(HISTORYLOG);
|
||||
UNSET(POS_HISTORY);
|
||||
UNSET(POSITIONLOG);
|
||||
}
|
||||
|
||||
/* If the user wants history persistence, read the relevant files. */
|
||||
if (ISSET(HISTORYLOG))
|
||||
load_history();
|
||||
if (ISSET(POS_HISTORY))
|
||||
if (ISSET(POSITIONLOG))
|
||||
load_poshistory();
|
||||
#endif /* ENABLE_HISTORIES */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If backups are enabled and a backup directory was specified and
|
||||
* we're not in restricted mode, make sure the path exists and is
|
||||
* a directory, so that backup files can be saved there. */
|
||||
if (ISSET(BACKUP_FILE) && backup_dir != NULL && !ISSET(RESTRICTED))
|
||||
/* If backups are enabled and a backup directory was specified, make sure
|
||||
* the path exists and is a folder, so backup files can be saved there. */
|
||||
if (ISSET(BACKUP_FILE) && backup_dir != NULL)
|
||||
init_backup_dir();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
/* Set up the operating directory. This entails chdir()ing there,
|
||||
* so that file reads and writes will be based there. */
|
||||
@@ -2495,8 +2490,9 @@ int main(int argc, char **argv)
|
||||
* does (unless we're using restricted mode, in which case spell
|
||||
* checking is disabled, since it would allow reading from or
|
||||
* writing to files not specified on the command line). */
|
||||
if (!ISSET(RESTRICTED) && alt_speller == NULL) {
|
||||
if (alt_speller == NULL && !ISSET(RESTRICTED)) {
|
||||
const char *spellenv = getenv("SPELL");
|
||||
|
||||
if (spellenv != NULL)
|
||||
alt_speller = mallocstrcpy(NULL, spellenv);
|
||||
}
|
||||
@@ -2571,31 +2567,35 @@ int main(int argc, char **argv)
|
||||
mouse_init();
|
||||
#endif
|
||||
|
||||
/* Ask ncurses for the key codes for Control+Left/Right/Up/Down. */
|
||||
/* Ask ncurses for the key codes for most modified editing keys. */
|
||||
controlleft = get_keycode("kLFT5", CONTROL_LEFT);
|
||||
controlright = get_keycode("kRIT5", CONTROL_RIGHT);
|
||||
controlup = get_keycode("kUP5", CONTROL_UP);
|
||||
controldown = get_keycode("kDN5", CONTROL_DOWN);
|
||||
/* Ask for the codes for Control+Home/End. */
|
||||
|
||||
controlhome = get_keycode("kHOM5", CONTROL_HOME);
|
||||
controlend = get_keycode("kEND5", CONTROL_END);
|
||||
controldelete = get_keycode("kDC5", CONTROL_DELETE);
|
||||
controlshiftdelete = get_keycode("kDC6", KEY_BACKSPACE);
|
||||
#ifndef NANO_TINY
|
||||
/* Ask for the codes for Shift+Control+Left/Right/Up/Down. */
|
||||
controldelete = get_keycode("kDC5", CONTROL_DELETE);
|
||||
controlshiftdelete = get_keycode("kDC6", CONTROL_SHIFT_DELETE);
|
||||
|
||||
shiftup = get_keycode("kUP", SHIFT_UP);
|
||||
shiftdown = get_keycode("kDN", SHIFT_DOWN);
|
||||
|
||||
shiftcontrolleft = get_keycode("kLFT6", SHIFT_CONTROL_LEFT);
|
||||
shiftcontrolright = get_keycode("kRIT6", SHIFT_CONTROL_RIGHT);
|
||||
shiftcontrolup = get_keycode("kUP6", SHIFT_CONTROL_UP);
|
||||
shiftcontroldown = get_keycode("kDN6", SHIFT_CONTROL_DOWN);
|
||||
/* Ask for the codes for Shift+Control+Home/End. */
|
||||
|
||||
shiftcontrolhome = get_keycode("kHOM6", SHIFT_CONTROL_HOME);
|
||||
shiftcontrolend = get_keycode("kEND6", SHIFT_CONTROL_END);
|
||||
/* Ask for the codes for Alt+Left/Right/Up/Down. */
|
||||
|
||||
altleft = get_keycode("kLFT3", ALT_LEFT);
|
||||
altright = get_keycode("kRIT3", ALT_RIGHT);
|
||||
altup = get_keycode("kUP3", ALT_UP);
|
||||
altdown = get_keycode("kDN3", ALT_DOWN);
|
||||
/* Ask for the codes for Shift+Alt+Left/Right/Up/Down. */
|
||||
altdelete = get_keycode("kDC3", ALT_DELETE);
|
||||
|
||||
shiftaltleft = get_keycode("kLFT4", SHIFT_ALT_LEFT);
|
||||
shiftaltright = get_keycode("kRIT4", SHIFT_ALT_RIGHT);
|
||||
shiftaltup = get_keycode("kUP4", SHIFT_ALT_UP);
|
||||
@@ -2634,7 +2634,7 @@ int main(int argc, char **argv)
|
||||
if (givenline != 0 || givencol != 0)
|
||||
do_gotolinecolumn(givenline, givencol, FALSE, FALSE);
|
||||
#ifdef ENABLE_HISTORIES
|
||||
else if (ISSET(POS_HISTORY) && openfile->filename[0] != '\0') {
|
||||
else if (ISSET(POSITIONLOG) && openfile->filename[0] != '\0') {
|
||||
ssize_t savedline, savedcol;
|
||||
/* If edited before, restore the last cursor position. */
|
||||
if (has_old_position(argv[optind - 1], &savedline, &savedcol))
|
||||
@@ -2655,6 +2655,8 @@ int main(int argc, char **argv)
|
||||
openfile = openfile->next;
|
||||
if (more_than_one)
|
||||
mention_name_and_linecount();
|
||||
if (ISSET(VIEW_MODE))
|
||||
SET(MULTIBUFFER);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2680,7 +2682,7 @@ int main(int argc, char **argv)
|
||||
confirm_margin();
|
||||
#endif
|
||||
if (currmenu != MMAIN)
|
||||
display_main_list();
|
||||
bottombars(MMAIN);
|
||||
|
||||
lastmessage = HUSH;
|
||||
as_an_at = TRUE;
|
||||
|
||||
24
src/nano.h
24
src/nano.h
@@ -153,7 +153,7 @@ typedef enum {
|
||||
} file_format;
|
||||
|
||||
typedef enum {
|
||||
HUSH, MILD, ALERT
|
||||
HUSH, NOTICE, MILD, ALERT
|
||||
} message_type;
|
||||
|
||||
typedef enum {
|
||||
@@ -178,7 +178,7 @@ typedef enum {
|
||||
#ifdef ENABLE_COMMENT
|
||||
COMMENT, UNCOMMENT, PREFLIGHT,
|
||||
#endif
|
||||
CUT, CUT_TO_EOF, PASTE, INSERT, COUPLE_BEGIN, COUPLE_END, OTHER
|
||||
ZAP, CUT, CUT_TO_EOF, PASTE, INSERT, COUPLE_BEGIN, COUPLE_END, OTHER
|
||||
} undo_type;
|
||||
|
||||
/* Structure types. */
|
||||
@@ -531,7 +531,7 @@ enum
|
||||
BOLD_TEXT,
|
||||
QUIET,
|
||||
SOFTWRAP,
|
||||
POS_HISTORY,
|
||||
POSITIONLOG,
|
||||
LOCKING,
|
||||
NOREAD_MODE,
|
||||
MAKE_IT_UNIX,
|
||||
@@ -540,7 +540,8 @@ enum
|
||||
LINE_NUMBERS,
|
||||
NO_PAUSES,
|
||||
AT_BLANKS,
|
||||
AFTER_ENDS
|
||||
AFTER_ENDS,
|
||||
LET_THEM_ZAP
|
||||
};
|
||||
|
||||
/* Flags for the menus in which a given function should be present. */
|
||||
@@ -560,11 +561,11 @@ enum
|
||||
#define MYESNO (1<<13)
|
||||
#define MLINTER (1<<14)
|
||||
#define MFINDINHELP (1<<15)
|
||||
/* This is an abbreviation for all menus except Help and YesNo. */
|
||||
/* This is an abbreviation for all menus except Help and Browser and YesNo. */
|
||||
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
|
||||
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
|
||||
MEXTCMD|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
|
||||
#ifndef NANO_TINY
|
||||
#define MSOME MMOST
|
||||
#define MSOME MMOST|MBROWSER
|
||||
#else
|
||||
#define MSOME MMAIN|MBROWSER
|
||||
#endif
|
||||
@@ -581,25 +582,32 @@ enum
|
||||
#define CONTROL_DOWN 0x404
|
||||
#define CONTROL_HOME 0x405
|
||||
#define CONTROL_END 0x406
|
||||
#define CONTROL_DELETE 0x407
|
||||
#define CONTROL_DELETE 0x40D
|
||||
#define SHIFT_CONTROL_LEFT 0x411
|
||||
#define SHIFT_CONTROL_RIGHT 0x412
|
||||
#define SHIFT_CONTROL_UP 0x413
|
||||
#define SHIFT_CONTROL_DOWN 0x414
|
||||
#define SHIFT_CONTROL_HOME 0x415
|
||||
#define SHIFT_CONTROL_END 0x416
|
||||
#define CONTROL_SHIFT_DELETE 0x41D
|
||||
#define ALT_LEFT 0x421
|
||||
#define ALT_RIGHT 0x422
|
||||
#define ALT_UP 0x423
|
||||
#define ALT_DOWN 0x424
|
||||
#define ALT_DELETE 0x42D
|
||||
#define SHIFT_ALT_LEFT 0x431
|
||||
#define SHIFT_ALT_RIGHT 0x432
|
||||
#define SHIFT_ALT_UP 0x433
|
||||
#define SHIFT_ALT_DOWN 0x434
|
||||
//#define SHIFT_LEFT 0x451
|
||||
//#define SHIFT_RIGHT 0x452
|
||||
#define SHIFT_UP 0x453
|
||||
#define SHIFT_DOWN 0x454
|
||||
#define SHIFT_HOME 0x455
|
||||
#define SHIFT_END 0x456
|
||||
#define SHIFT_PAGEUP 0x457
|
||||
#define SHIFT_PAGEDOWN 0x458
|
||||
#define SHIFT_DELETE 0x45D
|
||||
#define SHIFT_TAB 0x45F
|
||||
|
||||
#ifdef USE_SLANG
|
||||
|
||||
@@ -446,8 +446,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
char *history = NULL;
|
||||
/* The current history string. */
|
||||
char *magichistory = NULL;
|
||||
/* The temporary string typed at the bottom of the history, if
|
||||
* any. */
|
||||
/* The (partial) answer that was typed at the prompt, if any. */
|
||||
#ifdef ENABLE_TABCOMP
|
||||
int last_kbinput = ERR;
|
||||
/* The key we pressed before the current key. */
|
||||
@@ -534,9 +533,8 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
typing_x = strlen(answer);
|
||||
}
|
||||
|
||||
/* If, after scrolling down, we're at the bottom of the
|
||||
* history list, answer is blank, and magichistory is set,
|
||||
* save magichistory in answer. */
|
||||
/* If we've reached the bottom of the history list, and answer
|
||||
* is blank, and magichistory is set, restore the old answer. */
|
||||
if ((*history_list)->next == NULL &&
|
||||
*answer == '\0' && magichistory != NULL) {
|
||||
answer = mallocstrcpy(answer, magichistory);
|
||||
|
||||
67
src/proto.h
67
src/proto.h
@@ -55,33 +55,25 @@ extern bool also_the_last;
|
||||
|
||||
extern int didfind;
|
||||
|
||||
extern int controlleft;
|
||||
extern int controlright;
|
||||
extern int controlup;
|
||||
extern int controldown;
|
||||
extern int controlhome;
|
||||
extern int controlend;
|
||||
extern int controldelete;
|
||||
extern int controlshiftdelete;
|
||||
extern int controlleft, controlright;
|
||||
extern int controlup, controldown;
|
||||
extern int controlhome, controlend;
|
||||
#ifndef NANO_TINY
|
||||
extern int shiftcontrolleft;
|
||||
extern int shiftcontrolright;
|
||||
extern int shiftcontrolup;
|
||||
extern int shiftcontroldown;
|
||||
extern int shiftcontrolhome;
|
||||
extern int shiftcontrolend;
|
||||
extern int altleft;
|
||||
extern int altright;
|
||||
extern int altup;
|
||||
extern int altdown;
|
||||
extern int shiftaltleft;
|
||||
extern int shiftaltright;
|
||||
extern int shiftaltup;
|
||||
extern int shiftaltdown;
|
||||
extern int controldelete, controlshiftdelete;
|
||||
extern int shiftleft, shiftright;
|
||||
extern int shiftup, shiftdown;
|
||||
extern int shiftcontrolleft, shiftcontrolright;
|
||||
extern int shiftcontrolup, shiftcontroldown;
|
||||
extern int shiftcontrolhome, shiftcontrolend;
|
||||
extern int altleft, altright;
|
||||
extern int altup, altdown;
|
||||
extern int altdelete;
|
||||
extern int shiftaltleft, shiftaltright;
|
||||
extern int shiftaltup, shiftaltdown;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
extern ssize_t fill;
|
||||
extern ssize_t wrap_at, fill;
|
||||
#endif
|
||||
|
||||
extern char *last_search;
|
||||
@@ -183,6 +175,10 @@ extern char *statedir;
|
||||
extern char *rcfile_with_errors;
|
||||
#endif
|
||||
|
||||
extern bool spotlighted;
|
||||
extern size_t light_from_col;
|
||||
extern size_t light_to_col;
|
||||
|
||||
typedef void (*functionptrtype)(void);
|
||||
|
||||
/* Most functions in browser.c. */
|
||||
@@ -251,15 +247,15 @@ void precalc_multicolorinfo(void);
|
||||
|
||||
/* Most functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
bool keeping_cutbuffer(void);
|
||||
#ifndef NANO_TINY
|
||||
void cut_marked(bool *right_side_up);
|
||||
#endif
|
||||
void do_cut_text(bool copy_text, bool marked, bool cut_till_eof);
|
||||
void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append);
|
||||
void do_cut_text_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_copy_text(void);
|
||||
void do_cut_till_eof(void);
|
||||
void zap_text(void);
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
|
||||
@@ -323,10 +319,6 @@ int keycode_from_string(const char *keystring);
|
||||
void assign_keyinfo(sc *s, const char *keystring, const int keycode);
|
||||
void print_sclist(void);
|
||||
void shortcut_init(void);
|
||||
#ifdef ENABLE_COLOR
|
||||
void set_linter_shortcut(void);
|
||||
void set_speller_shortcut(void);
|
||||
#endif
|
||||
const subnfunc *sctofunc(const sc *s);
|
||||
const char *flagtostr(int flag);
|
||||
#ifdef ENABLE_NANORC
|
||||
@@ -371,22 +363,22 @@ void to_last_line(void);
|
||||
void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
void do_para_begin(bool update_screen);
|
||||
void do_para_end(bool update_screen);
|
||||
void do_para_begin(void);
|
||||
void do_para_end(void);
|
||||
void do_para_begin_void(void);
|
||||
void do_para_end_void(void);
|
||||
#endif
|
||||
void do_prev_block(void);
|
||||
void do_next_block(void);
|
||||
void do_prev_word(bool allow_punct, bool update_screen);
|
||||
bool do_next_word(bool after_ends, bool allow_punct, bool update_screen);
|
||||
void do_prev_word(bool allow_punct);
|
||||
bool do_next_word(bool after_ends, bool allow_punct);
|
||||
void do_prev_word_void(void);
|
||||
void do_next_word_void(void);
|
||||
void do_home(void);
|
||||
void do_end(void);
|
||||
void do_up(void);
|
||||
void do_down(void);
|
||||
#ifdef ENABLE_HELP
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
void do_scroll_up(void);
|
||||
void do_scroll_down(void);
|
||||
#endif
|
||||
@@ -408,7 +400,6 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
|
||||
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
|
||||
void ingraft_buffer(filestruct *somebuffer);
|
||||
void copy_from_buffer(filestruct *somebuffer);
|
||||
openfilestruct *make_new_opennode(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void unlink_opennode(openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
@@ -433,7 +424,6 @@ RETSIGTYPE do_continue(int signal);
|
||||
#ifndef NANO_TINY
|
||||
RETSIGTYPE handle_sigwinch(int signal);
|
||||
void regenerate_screen(void);
|
||||
void allow_sigwinch(bool allow);
|
||||
void do_toggle(int flag);
|
||||
void enable_signals(void);
|
||||
#endif
|
||||
@@ -671,12 +661,11 @@ void edit_refresh(void);
|
||||
void adjust_viewport(update_type location);
|
||||
void total_redraw(void);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
void do_cursorpos(bool force);
|
||||
void do_cursorpos_void(void);
|
||||
void spotlight(bool active, size_t from_col, size_t to_col);
|
||||
void spotlight(size_t from_col, size_t to_col);
|
||||
#ifndef NANO_TINY
|
||||
void spotlight_softwrapped(bool active, size_t from_col, size_t to_col);
|
||||
void spotlight_softwrapped(size_t from_col, size_t to_col);
|
||||
#endif
|
||||
void do_suspend_void(void);
|
||||
void disable_waiting(void);
|
||||
|
||||
14
src/rcfile.c
14
src/rcfile.c
@@ -69,7 +69,7 @@ static const rcoption rcopts[] = {
|
||||
{"operatingdir", 0},
|
||||
#endif
|
||||
#ifdef ENABLE_HISTORIES
|
||||
{"positionlog", POS_HISTORY},
|
||||
{"positionlog", POSITIONLOG},
|
||||
#endif
|
||||
{"preserve", PRESERVE},
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
@@ -112,6 +112,7 @@ static const rcoption rcopts[] = {
|
||||
{"whitespace", 0},
|
||||
{"wordbounds", WORD_BOUNDS},
|
||||
{"wordchars", 0},
|
||||
{"zap", LET_THEM_ZAP},
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
{"titlecolor", 0},
|
||||
@@ -451,7 +452,9 @@ void parse_binding(char *ptr, bool dobind)
|
||||
menu = menu & (is_universal(newsc->func) ? MMOST : mask);
|
||||
|
||||
if (!menu) {
|
||||
rcfile_error(N_("Function '%s' does not exist in menu '%s'"), funcptr, menuptr);
|
||||
if (!ISSET(RESTRICTED))
|
||||
rcfile_error(N_("Function '%s' does not exist in menu '%s'"),
|
||||
funcptr, menuptr);
|
||||
goto free_things;
|
||||
}
|
||||
|
||||
@@ -923,8 +926,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
while (isblank((unsigned char)*ptr))
|
||||
ptr++;
|
||||
|
||||
/* If we have a blank line or a comment, skip to the next
|
||||
* line. */
|
||||
/* If the line is empty or a comment, skip to next line. */
|
||||
if (*ptr == '\0' || *ptr == '#')
|
||||
continue;
|
||||
|
||||
@@ -1102,10 +1104,10 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
#endif
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "fill") == 0) {
|
||||
if (!parse_num(option, &fill)) {
|
||||
if (!parse_num(option, &wrap_at)) {
|
||||
rcfile_error(N_("Requested fill size \"%s\" is invalid"),
|
||||
option);
|
||||
fill = -COLUMNS_FROM_EOL;
|
||||
wrap_at = -COLUMNS_FROM_EOL;
|
||||
} else
|
||||
UNSET(NO_WRAP);
|
||||
free(option);
|
||||
|
||||
15
src/search.c
15
src/search.c
@@ -155,6 +155,12 @@ void search_init(bool replacing, bool keep_the_answer)
|
||||
} else if (func == regexp_void) {
|
||||
TOGGLE(USE_REGEXP);
|
||||
} else if (func == flip_replace) {
|
||||
if (ISSET(VIEW_MODE)) {
|
||||
print_view_warning();
|
||||
tidy_up_after_search();
|
||||
free(thedefault);
|
||||
return;
|
||||
}
|
||||
replacing = !replacing;
|
||||
} else {
|
||||
if (func == flip_goto)
|
||||
@@ -569,19 +575,18 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
numreplaced = 0;
|
||||
|
||||
if (!replaceall) {
|
||||
size_t from_col = xplustabs();
|
||||
size_t to_col = strnlenpt(openfile->current->data,
|
||||
spotlighted = TRUE;
|
||||
light_from_col = xplustabs();
|
||||
light_to_col = strnlenpt(openfile->current->data,
|
||||
openfile->current_x + match_len);
|
||||
|
||||
/* Refresh the edit window, scrolling it if necessary. */
|
||||
edit_refresh();
|
||||
|
||||
spotlight(TRUE, from_col, to_col);
|
||||
|
||||
/* TRANSLATORS: This is a prompt. */
|
||||
i = do_yesno_prompt(TRUE, _("Replace this instance?"));
|
||||
|
||||
spotlight(FALSE, from_col, to_col);
|
||||
spotlighted = FALSE;
|
||||
|
||||
if (i == -1) /* The replacing was cancelled. */
|
||||
break;
|
||||
|
||||
581
src/text.c
581
src/text.c
@@ -99,7 +99,13 @@ void do_deletion(undo_type action)
|
||||
openfile->current_x);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
update_undo(action);
|
||||
/* If the type of action changed or the cursor moved to a different
|
||||
* line, create a new undo item, otherwise update the existing item. */
|
||||
if (action != openfile->last_action ||
|
||||
openfile->current->lineno != openfile->current_undo->lineno)
|
||||
add_undo(action);
|
||||
else
|
||||
update_undo(action);
|
||||
|
||||
if (ISSET(SOFTWRAP))
|
||||
old_amount = number_of_chunks_in(openfile->current);
|
||||
@@ -177,6 +183,11 @@ void do_deletion(undo_type action)
|
||||
/* Delete the character under the cursor. */
|
||||
void do_delete(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark && ISSET(LET_THEM_ZAP))
|
||||
zap_text();
|
||||
else
|
||||
#endif
|
||||
do_deletion(DEL);
|
||||
}
|
||||
|
||||
@@ -184,6 +195,11 @@ void do_delete(void)
|
||||
* character, and then delete the character under the cursor. */
|
||||
void do_backspace(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark && ISSET(LET_THEM_ZAP))
|
||||
zap_text();
|
||||
else
|
||||
#endif
|
||||
if (openfile->current != openfile->fileage || openfile->current_x > 0) {
|
||||
do_left();
|
||||
do_deletion(BACK);
|
||||
@@ -210,7 +226,7 @@ void do_cutword(bool backward)
|
||||
* on the edge of the original line, then put the cursor on that
|
||||
* edge instead, so that lines will not be joined unexpectedly. */
|
||||
if (backward) {
|
||||
do_prev_word(ISSET(WORD_BOUNDS), FALSE);
|
||||
do_prev_word(ISSET(WORD_BOUNDS));
|
||||
if (openfile->current != is_current) {
|
||||
if (is_current_x > 0) {
|
||||
openfile->current = is_current;
|
||||
@@ -219,7 +235,7 @@ void do_cutword(bool backward)
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
}
|
||||
} else {
|
||||
do_next_word(FALSE, ISSET(WORD_BOUNDS), FALSE);
|
||||
do_next_word(FALSE, ISSET(WORD_BOUNDS));
|
||||
if (openfile->current != is_current &&
|
||||
is_current->data[is_current_x] != '\0') {
|
||||
openfile->current = is_current;
|
||||
@@ -681,7 +697,7 @@ void redo_cut(undo *u)
|
||||
openfile->mark = fsfromline(u->mark_begin_lineno);
|
||||
openfile->mark_x = (u->xflags == WAS_WHOLE_LINE) ? 0 : u->mark_begin_x;
|
||||
|
||||
do_cut_text(FALSE, TRUE, FALSE);
|
||||
do_cut_text(FALSE, TRUE, FALSE, u->type == ZAP);
|
||||
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = oldcutbuffer;
|
||||
@@ -786,6 +802,10 @@ void do_undo(void)
|
||||
undidmsg = _("text add");
|
||||
break;
|
||||
#endif
|
||||
case ZAP:
|
||||
undidmsg = _("erasure");
|
||||
undo_cut(u);
|
||||
break;
|
||||
case CUT_TO_EOF:
|
||||
case CUT:
|
||||
undidmsg = _("text cut");
|
||||
@@ -962,6 +982,10 @@ void do_redo(void)
|
||||
redidmsg = _("text add");
|
||||
break;
|
||||
#endif
|
||||
case ZAP:
|
||||
redidmsg = _("erasure");
|
||||
redo_cut(u);
|
||||
break;
|
||||
case CUT_TO_EOF:
|
||||
case CUT:
|
||||
redidmsg = _("text cut");
|
||||
@@ -1195,7 +1219,7 @@ bool execute_command(const char *command)
|
||||
if (ISSET(MULTIBUFFER)) {
|
||||
switch_to_prev_buffer();
|
||||
if (openfile->mark)
|
||||
do_cut_text(TRUE, TRUE, FALSE);
|
||||
do_cut_text(TRUE, TRUE, FALSE, FALSE);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -1206,7 +1230,7 @@ bool execute_command(const char *command)
|
||||
openfile->current_x = 0;
|
||||
}
|
||||
add_undo(CUT);
|
||||
do_cut_text(FALSE, openfile->mark, openfile->mark == NULL);
|
||||
do_cut_text(FALSE, openfile->mark, openfile->mark == NULL, FALSE);
|
||||
update_undo(CUT);
|
||||
}
|
||||
|
||||
@@ -1313,13 +1337,6 @@ void add_undo(undo_type action)
|
||||
undo *u = openfile->current_undo;
|
||||
/* The thing we did previously. */
|
||||
|
||||
/* When doing contiguous adds or cuts, don't add a new undo item. */
|
||||
if (u != NULL && action == openfile->last_action && action == u->type &&
|
||||
openfile->current->lineno == u->mark_begin_lineno &&
|
||||
((action == ADD && u->mark_begin_x == openfile->current_x) ||
|
||||
(action == CUT && keeping_cutbuffer())))
|
||||
return;
|
||||
|
||||
/* Blow away newer undo items if we add somewhere in the middle. */
|
||||
discard_until(u, openfile, TRUE);
|
||||
|
||||
@@ -1404,6 +1421,7 @@ void add_undo(undo_type action)
|
||||
#endif
|
||||
case CUT_TO_EOF:
|
||||
break;
|
||||
case ZAP:
|
||||
case CUT:
|
||||
if (openfile->mark) {
|
||||
u->mark_begin_lineno = openfile->mark->lineno;
|
||||
@@ -1474,23 +1492,14 @@ void update_multiline_undo(ssize_t lineno, char *indentation)
|
||||
u->newsize = openfile->totsize;
|
||||
}
|
||||
|
||||
/* Update an undo record, after checking that a new one is not needed. */
|
||||
/* Update an undo item with (among other things) the file size and
|
||||
* cursor position after the given action. */
|
||||
void update_undo(undo_type action)
|
||||
{
|
||||
undo *u = openfile->undotop;
|
||||
char *char_buf;
|
||||
int char_len;
|
||||
|
||||
/* If the action is different or the position changed, don't update the
|
||||
* current record but add a new one instead. */
|
||||
if (action != openfile->last_action ||
|
||||
(action != ENTER && action != CUT && action != INSERT &&
|
||||
action != COUPLE_END &&
|
||||
openfile->current->lineno != openfile->current_undo->lineno)) {
|
||||
add_undo(action);
|
||||
return;
|
||||
}
|
||||
|
||||
u->newsize = openfile->totsize;
|
||||
|
||||
switch (u->type) {
|
||||
@@ -1531,20 +1540,25 @@ void update_undo(undo_type action)
|
||||
break;
|
||||
case REPLACE:
|
||||
case PASTE:
|
||||
u->begin = openfile->current_x;
|
||||
u->lineno = openfile->current->lineno;
|
||||
u->begin = openfile->current_x;
|
||||
break;
|
||||
#ifdef ENABLE_WRAPPING
|
||||
case SPLIT_BEGIN:
|
||||
case SPLIT_END:
|
||||
break;
|
||||
#endif
|
||||
case ZAP:
|
||||
case CUT_TO_EOF:
|
||||
case CUT:
|
||||
if (!cutbuffer)
|
||||
break;
|
||||
free_filestruct(u->cutbuffer);
|
||||
u->cutbuffer = copy_filestruct(cutbuffer);
|
||||
if (u->type == ZAP)
|
||||
u->cutbuffer = cutbuffer;
|
||||
else {
|
||||
free_filestruct(u->cutbuffer);
|
||||
u->cutbuffer = copy_filestruct(cutbuffer);
|
||||
}
|
||||
if (u->xflags == MARK_WAS_SET) {
|
||||
/* If the "marking" operation was from right-->left or
|
||||
* bottom-->top, then swap the mark points. */
|
||||
@@ -2145,7 +2159,7 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||
/* If the current line isn't in a paragraph, move forward to the
|
||||
* last line of the next paragraph, if any. */
|
||||
if (!inpar(openfile->current)) {
|
||||
do_para_end(FALSE);
|
||||
do_para_end();
|
||||
|
||||
/* If we end up past the beginning of the line, it means that
|
||||
* we're at the end of the last line of the file, and the line
|
||||
@@ -2167,14 +2181,14 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||
/* If the current line is in a paragraph and isn't its first line, move
|
||||
* back to the first line of the paragraph. */
|
||||
if (inpar(openfile->current) && !begpar(openfile->current, 0))
|
||||
do_para_begin(FALSE);
|
||||
do_para_begin();
|
||||
|
||||
/* Now current is the first line of the paragraph. Set quote_len to
|
||||
* the quotation length of that line, and set par_len to the number
|
||||
* of lines in this paragraph. */
|
||||
quote_len = quote_length(openfile->current->data);
|
||||
current_save = openfile->current;
|
||||
do_para_end(FALSE);
|
||||
do_para_end();
|
||||
par_len = openfile->current->lineno - current_save->lineno;
|
||||
|
||||
/* If we end up past the beginning of the line, it means that we're at
|
||||
@@ -2191,10 +2205,157 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Run every line of the current paragraph through justify_format(). Assume
|
||||
* that current is at the beginning of the paragraph, quote_len is the length
|
||||
* of the paragraph's quote string, and par_len is the number of lines in the
|
||||
* paragraph. */
|
||||
void justify_paragraph(size_t quote_len, size_t par_len)
|
||||
{
|
||||
filestruct *firstline;
|
||||
/* The first line of the current paragraph. */
|
||||
filestruct *sampleline;
|
||||
/* The line from which the indentation is copied -- either
|
||||
* the first and only or the second line of the paragraph. */
|
||||
size_t lead_len;
|
||||
/* Length of the quote part plus the indentation part. */
|
||||
ssize_t break_pos;
|
||||
/* Where we will break lines. */
|
||||
char *lead_string;
|
||||
/* The quote+indent stuff that is copied from the sample line. */
|
||||
|
||||
/* Remember the first line of the current paragraph. */
|
||||
firstline = openfile->current;
|
||||
|
||||
/* The sample line is either the only line or the second line. */
|
||||
sampleline = (par_len == 1 ? firstline : firstline->next);
|
||||
|
||||
/* Copy the leading part (quoting + indentation) of the sample line. */
|
||||
lead_len = quote_len + indent_length(sampleline->data + quote_len);
|
||||
lead_string = mallocstrncpy(NULL, sampleline->data, lead_len + 1);
|
||||
lead_string[lead_len] = '\0';
|
||||
|
||||
/* Now tack all the lines of the paragraph together, skipping
|
||||
* the quoting and indentation on all lines after the first. */
|
||||
while (par_len > 1) {
|
||||
filestruct *next_line = openfile->current->next;
|
||||
size_t line_len = strlen(openfile->current->data);
|
||||
size_t next_line_len = strlen(next_line->data);
|
||||
|
||||
lead_len = quote_len + indent_length(next_line->data + quote_len);
|
||||
|
||||
/* We're just about to tack the next line onto this one. If
|
||||
* this line isn't empty, make sure it ends in a space. */
|
||||
if (line_len > 0 && openfile->current->data[line_len - 1] != ' ') {
|
||||
openfile->current->data =
|
||||
charealloc(openfile->current->data, line_len + 2);
|
||||
openfile->current->data[line_len++] = ' ';
|
||||
openfile->current->data[line_len] = '\0';
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
openfile->current->data = charealloc(openfile->current->data,
|
||||
line_len + next_line_len - lead_len + 1);
|
||||
strcat(openfile->current->data, next_line->data + lead_len);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If needed, adjust the coordinates of the mark. */
|
||||
if (openfile->mark == next_line) {
|
||||
openfile->mark = openfile->current;
|
||||
openfile->mark_x += line_len - lead_len;
|
||||
}
|
||||
#endif
|
||||
/* Don't destroy edittop! */
|
||||
if (next_line == openfile->edittop)
|
||||
openfile->edittop = openfile->current;
|
||||
|
||||
unlink_node(next_line);
|
||||
openfile->totsize -= lead_len + 1;
|
||||
par_len--;
|
||||
}
|
||||
|
||||
/* Call justify_format() on the paragraph, which will remove excess
|
||||
* spaces from it and change all blank characters to spaces. */
|
||||
justify_format(openfile->current, quote_len +
|
||||
indent_length(openfile->current->data + quote_len));
|
||||
|
||||
while (par_len > 0 && strlenpt(openfile->current->data) > fill) {
|
||||
size_t line_len = strlen(openfile->current->data);
|
||||
|
||||
/* If this line is too long, try to wrap it to the next line
|
||||
* to make it short enough. */
|
||||
break_pos = break_line(openfile->current->data + lead_len,
|
||||
fill - strnlenpt(openfile->current->data, lead_len), FALSE);
|
||||
|
||||
/* If we can't break the line, or don't need to, we're done. */
|
||||
if (break_pos == -1 || break_pos + lead_len == line_len)
|
||||
break;
|
||||
|
||||
/* Adjust the breaking position for the leading part and
|
||||
* move it beyond the found whitespace character. */
|
||||
break_pos += lead_len + 1;
|
||||
|
||||
/* Insert a new line after the current one and allocate it. */
|
||||
splice_node(openfile->current, make_new_node(openfile->current));
|
||||
openfile->current->next->data = charalloc(lead_len + 1 +
|
||||
line_len - break_pos);
|
||||
|
||||
/* Copy the leading part and the text after the breaking point
|
||||
* into the next line. */
|
||||
strncpy(openfile->current->next->data, lead_string, lead_len);
|
||||
strcpy(openfile->current->next->data + lead_len,
|
||||
openfile->current->data + break_pos);
|
||||
|
||||
openfile->totsize += lead_len + 1;
|
||||
par_len++;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If needed, compensate the mark coordinates for the change
|
||||
* in the current line. */
|
||||
if (openfile->mark == openfile->current &&
|
||||
openfile->mark_x > break_pos) {
|
||||
openfile->mark = openfile->current->next;
|
||||
openfile->mark_x -= break_pos - lead_len;
|
||||
}
|
||||
#endif
|
||||
/* When requested, snip all trailing blanks. */
|
||||
if (ISSET(TRIM_BLANKS)) {
|
||||
while (break_pos > 0 &&
|
||||
is_blank_mbchar(&openfile->current->data[break_pos - 1])) {
|
||||
break_pos--;
|
||||
openfile->totsize--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Break the current line. */
|
||||
null_at(&openfile->current->data, break_pos);
|
||||
|
||||
/* Go to the next line. */
|
||||
openfile->current = openfile->current->next;
|
||||
par_len--;
|
||||
}
|
||||
|
||||
free(lead_string);
|
||||
|
||||
/* Go to the next line, if possible. If there is no next line,
|
||||
* move to the end of the current line. */
|
||||
if (openfile->current != openfile->filebot)
|
||||
openfile->current = openfile->current->next;
|
||||
else
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
|
||||
/* Renumber the now-justified paragraph, since both refreshing the
|
||||
* edit window and finding a paragraph need correct line numbers. */
|
||||
renumber(firstline);
|
||||
}
|
||||
|
||||
/* Justify the current paragraph, and justify the entire file when
|
||||
* full_justify is TRUE. */
|
||||
void do_justify(bool full_justify)
|
||||
{
|
||||
size_t quote_len;
|
||||
/* Length of the quote part of the current paragraph. */
|
||||
size_t par_len;
|
||||
/* Number of lines in the current paragraph. */
|
||||
filestruct *first_par_line = NULL;
|
||||
/* Will be the first line of the justified paragraph(s), if any.
|
||||
* For restoring after unjustify. */
|
||||
@@ -2228,200 +2389,47 @@ void do_justify(bool full_justify)
|
||||
if (full_justify)
|
||||
openfile->current = openfile->fileage;
|
||||
|
||||
while (TRUE) {
|
||||
filestruct *firstline;
|
||||
/* The first line of the current paragraph. */
|
||||
filestruct *sampleline;
|
||||
/* The line from which the indentation is copied -- either
|
||||
* the first and only or the second line of the paragraph. */
|
||||
size_t quote_len;
|
||||
/* Length of the quote part of the current paragraph. */
|
||||
size_t lead_len;
|
||||
/* Length of the quote part plus the indentation part. */
|
||||
size_t par_len;
|
||||
/* Number of lines in the current paragraph. */
|
||||
ssize_t break_pos;
|
||||
/* Where we will break lines. */
|
||||
char *lead_string;
|
||||
/* The quote+indent stuff that is copied from the sample line. */
|
||||
/* Find the first line of the paragraph(s) to be justified.
|
||||
* If the search failed, it means that there are no paragraph(s) to
|
||||
* justify, so refresh the screen and get out. */
|
||||
if (!find_paragraph("e_len, &par_len)) {
|
||||
refresh_needed = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find the first line of the paragraph to be justified. That
|
||||
* is the start of this paragraph if we're in one, or the start
|
||||
* of the next otherwise. Save the quote length and paragraph
|
||||
* length (number of lines). Don't refresh the screen yet,
|
||||
* since we'll do that after we justify.
|
||||
*
|
||||
* If the search failed, we do one of two things. If we're
|
||||
* justifying the whole file, and we've found at least one
|
||||
* paragraph, it means that we should justify all the way to the
|
||||
* last line of the file, so set the last line of the text to be
|
||||
* justified to the last line of the file and break out of the
|
||||
* loop. Otherwise, it means that there are no paragraph(s) to
|
||||
* justify, so refresh the screen and get out. */
|
||||
if (!find_paragraph("e_len, &par_len)) {
|
||||
if (full_justify && first_par_line != NULL) {
|
||||
last_par_line = openfile->filebot;
|
||||
break;
|
||||
} else {
|
||||
refresh_needed = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* Move the original paragraph(s)
|
||||
* to the justify buffer, splice a copy of the original
|
||||
* paragraph(s) into the file in the same place, and set
|
||||
* first_par_line to the first line of the copy. */
|
||||
backup_lines(openfile->current, full_justify ?
|
||||
openfile->filebot->lineno - openfile->current->lineno +
|
||||
((openfile->filebot->data[0] != '\0') ? 1 : 0) : par_len);
|
||||
first_par_line = openfile->current;
|
||||
|
||||
/* Search for a paragraph(s) and justify them. If we're justifying the
|
||||
* whole file, loop until we've found every paragraph. */
|
||||
do {
|
||||
/* par_len will be one greater than the number of lines between
|
||||
* current and filebot if filebot is the last line in the
|
||||
* paragraph. Set filebot_inpar to TRUE if this is the case. */
|
||||
filebot_inpar = (openfile->current->lineno + par_len ==
|
||||
openfile->filebot->lineno + 1);
|
||||
|
||||
/* If we haven't already done it, move the original paragraph(s)
|
||||
* to the justify buffer, splice a copy of the original
|
||||
* paragraph(s) into the file in the same place, and set
|
||||
* first_par_line to the first line of the copy. */
|
||||
if (first_par_line == NULL) {
|
||||
backup_lines(openfile->current, full_justify ?
|
||||
openfile->filebot->lineno - openfile->current->lineno +
|
||||
((openfile->filebot->data[0] != '\0') ? 1 : 0) : par_len);
|
||||
first_par_line = openfile->current;
|
||||
}
|
||||
/* Justify the current paragraph. */
|
||||
justify_paragraph(quote_len, par_len);
|
||||
|
||||
/* Remember the first line of the current paragraph. */
|
||||
firstline = openfile->current;
|
||||
/* If we're justifying the entire file,
|
||||
* find the next line of the paragraph(s) to be justified.
|
||||
* If the search failed, it means that there are no paragraph(s) to
|
||||
* justify, so break out of the loop. */
|
||||
} while (full_justify && find_paragraph("e_len, &par_len));
|
||||
|
||||
/* The sample line is either the only line or the second line. */
|
||||
sampleline = (par_len == 1 ? firstline : firstline->next);
|
||||
|
||||
/* Copy the leading part (quoting + indentation) of the sample line. */
|
||||
lead_len = quote_len + indent_length(sampleline->data + quote_len);
|
||||
lead_string = mallocstrncpy(NULL, sampleline->data, lead_len + 1);
|
||||
lead_string[lead_len] = '\0';
|
||||
|
||||
/* Now tack all the lines of the paragraph together, skipping
|
||||
* the quoting and indentation on all lines after the first. */
|
||||
while (par_len > 1) {
|
||||
filestruct *next_line = openfile->current->next;
|
||||
size_t line_len = strlen(openfile->current->data);
|
||||
size_t next_line_len = strlen(next_line->data);
|
||||
|
||||
lead_len = quote_len + indent_length(next_line->data + quote_len);
|
||||
|
||||
/* We're just about to tack the next line onto this one. If
|
||||
* this line isn't empty, make sure it ends in a space. */
|
||||
if (line_len > 0 && openfile->current->data[line_len - 1] != ' ') {
|
||||
openfile->current->data =
|
||||
charealloc(openfile->current->data, line_len + 2);
|
||||
openfile->current->data[line_len++] = ' ';
|
||||
openfile->current->data[line_len] = '\0';
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
openfile->current->data = charealloc(openfile->current->data,
|
||||
line_len + next_line_len - lead_len + 1);
|
||||
strcat(openfile->current->data, next_line->data + lead_len);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If needed, adjust the coordinates of the mark. */
|
||||
if (openfile->mark == next_line) {
|
||||
openfile->mark = openfile->current;
|
||||
openfile->mark_x += line_len - lead_len;
|
||||
}
|
||||
#endif
|
||||
/* Don't destroy edittop! */
|
||||
if (next_line == openfile->edittop)
|
||||
openfile->edittop = openfile->current;
|
||||
|
||||
unlink_node(next_line);
|
||||
openfile->totsize -= lead_len + 1;
|
||||
par_len--;
|
||||
}
|
||||
|
||||
/* Call justify_format() on the paragraph, which will remove excess
|
||||
* spaces from it and change all blank characters to spaces. */
|
||||
justify_format(openfile->current, quote_len +
|
||||
indent_length(openfile->current->data + quote_len));
|
||||
|
||||
while (par_len > 0 && strlenpt(openfile->current->data) > fill) {
|
||||
size_t line_len = strlen(openfile->current->data);
|
||||
|
||||
/* If this line is too long, try to wrap it to the next line
|
||||
* to make it short enough. */
|
||||
break_pos = break_line(openfile->current->data + lead_len,
|
||||
fill - strnlenpt(openfile->current->data, lead_len), FALSE);
|
||||
|
||||
/* If we can't break the line, or don't need to, we're done. */
|
||||
if (break_pos == -1 || break_pos + lead_len == line_len)
|
||||
break;
|
||||
|
||||
/* Adjust the breaking position for the leading part and
|
||||
* move it beyond the found whitespace character. */
|
||||
break_pos += lead_len + 1;
|
||||
|
||||
/* Insert a new line after the current one and allocate it. */
|
||||
splice_node(openfile->current, make_new_node(openfile->current));
|
||||
openfile->current->next->data = charalloc(lead_len + 1 +
|
||||
line_len - break_pos);
|
||||
|
||||
/* Copy the leading part and the text after the breaking point
|
||||
* into the next line. */
|
||||
strncpy(openfile->current->next->data, lead_string, lead_len);
|
||||
strcpy(openfile->current->next->data + lead_len,
|
||||
openfile->current->data + break_pos);
|
||||
|
||||
openfile->totsize += lead_len + 1;
|
||||
par_len++;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If needed, compensate the mark coordinates for the change
|
||||
* in the current line. */
|
||||
if (openfile->mark == openfile->current &&
|
||||
openfile->mark_x > break_pos) {
|
||||
openfile->mark = openfile->current->next;
|
||||
openfile->mark_x -= break_pos - lead_len;
|
||||
}
|
||||
#endif
|
||||
/* When requested, snip all trailing blanks. */
|
||||
if (ISSET(TRIM_BLANKS)) {
|
||||
while (break_pos > 0 &&
|
||||
is_blank_mbchar(&openfile->current->data[break_pos - 1])) {
|
||||
break_pos--;
|
||||
openfile->totsize--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Break the current line. */
|
||||
null_at(&openfile->current->data, break_pos);
|
||||
|
||||
/* Go to the next line. */
|
||||
openfile->current = openfile->current->next;
|
||||
par_len--;
|
||||
}
|
||||
|
||||
free(lead_string);
|
||||
|
||||
/* Go to the next line, if possible. If there is no next line,
|
||||
* move to the end of the current line. */
|
||||
if (openfile->current != openfile->filebot)
|
||||
openfile->current = openfile->current->next;
|
||||
else
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
|
||||
/* Renumber the now-justified paragraph, since both refreshing the
|
||||
* edit window and finding a paragraph need correct line numbers. */
|
||||
renumber(firstline);
|
||||
|
||||
/* We've just finished justifying the paragraph. If we're not
|
||||
* justifying the entire file, break out of the loop.
|
||||
* Otherwise, continue the loop so that we justify all the
|
||||
* paragraphs in the file. */
|
||||
if (!full_justify)
|
||||
break;
|
||||
}
|
||||
|
||||
/* We are now done justifying the paragraph or the file, so clean
|
||||
* up. totsize has been maintained above. If we actually justified
|
||||
* something, set last_par_line to the new end of the paragraph. */
|
||||
if (first_par_line != NULL)
|
||||
last_par_line = openfile->current;
|
||||
/* We are now done justifying the paragraph(s), so clean
|
||||
* up. totsize has been maintained above.
|
||||
* Set last_par_line to the end of the paragraph(s) justified.
|
||||
* If we've justified the entire file and broken out of the loop,
|
||||
* this should be the last line of the file. */
|
||||
last_par_line = openfile->current;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Let a justification cancel a soft mark. */
|
||||
@@ -2433,7 +2441,7 @@ void do_justify(bool full_justify)
|
||||
|
||||
/* Show "Unjustify" in the help lines. */
|
||||
uncutfunc->desc = unjust_tag;
|
||||
display_main_list();
|
||||
bottombars(MMAIN);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
kbinput = KEY_WINCH;
|
||||
@@ -2458,35 +2466,33 @@ void do_justify(bool full_justify)
|
||||
|| func == do_undo
|
||||
#endif
|
||||
) {
|
||||
/* If we actually justified something, then splice the preserved
|
||||
/* Splice the preserved
|
||||
* unjustified text back into the file, */
|
||||
if (first_par_line != NULL) {
|
||||
filestruct *trash = NULL, *dummy = NULL;
|
||||
filestruct *trash = NULL, *dummy = NULL;
|
||||
|
||||
/* Throw away the justified paragraph, and replace it with
|
||||
* the preserved unjustified text. */
|
||||
extract_buffer(&trash, &dummy, first_par_line, 0, last_par_line,
|
||||
/* Throw away the justified paragraph, and replace it with
|
||||
* the preserved unjustified text. */
|
||||
extract_buffer(&trash, &dummy, first_par_line, 0, last_par_line,
|
||||
filebot_inpar ? strlen(last_par_line->data) : 0);
|
||||
free_filestruct(trash);
|
||||
ingraft_buffer(jusbuffer);
|
||||
free_filestruct(trash);
|
||||
ingraft_buffer(jusbuffer);
|
||||
|
||||
/* Restore the old position and the mark. */
|
||||
openfile->edittop = edittop_save;
|
||||
openfile->firstcolumn = firstcolumn_save;
|
||||
openfile->current = current_save;
|
||||
openfile->current_x = current_x_save;
|
||||
/* Restore the old position and the mark. */
|
||||
openfile->edittop = edittop_save;
|
||||
openfile->firstcolumn = firstcolumn_save;
|
||||
openfile->current = current_save;
|
||||
openfile->current_x = current_x_save;
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark) {
|
||||
openfile->mark = was_mark;
|
||||
openfile->mark_x = was_mark_x;
|
||||
}
|
||||
#endif
|
||||
openfile->modified = modified_save;
|
||||
if (!openfile->modified)
|
||||
titlebar(NULL);
|
||||
|
||||
refresh_needed = TRUE;
|
||||
if (openfile->mark) {
|
||||
openfile->mark = was_mark;
|
||||
openfile->mark_x = was_mark_x;
|
||||
}
|
||||
#endif
|
||||
openfile->modified = modified_save;
|
||||
if (!openfile->modified)
|
||||
titlebar(NULL);
|
||||
|
||||
refresh_needed = TRUE;
|
||||
} else {
|
||||
/* Put the keystroke back into the queue. */
|
||||
unget_kbinput(kbinput, meta_key);
|
||||
@@ -2602,23 +2608,24 @@ bool fix_spello(const char *word)
|
||||
proceed = TRUE;
|
||||
napms(2800);
|
||||
} else if (result == 1) {
|
||||
size_t from_col = xplustabs();
|
||||
size_t to_col = from_col + strlenpt(word);
|
||||
spotlighted = TRUE;
|
||||
light_from_col = xplustabs();
|
||||
light_to_col = light_from_col + strlenpt(word);
|
||||
#ifndef NANO_TINY
|
||||
filestruct *saved_mark = openfile->mark;
|
||||
openfile->mark = NULL;
|
||||
#endif
|
||||
edit_refresh();
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark = saved_mark;
|
||||
#endif
|
||||
spotlight(TRUE, from_col, to_col);
|
||||
|
||||
/* Let the user supply a correctly spelled alternative. */
|
||||
proceed = (do_prompt(FALSE, FALSE, MSPELL, word, NULL,
|
||||
edit_refresh, _("Edit a replacement")) != -1);
|
||||
|
||||
spotlight(FALSE, from_col, to_col);
|
||||
spotlighted = FALSE;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark = saved_mark;
|
||||
#endif
|
||||
|
||||
/* If a replacement was given, go through all occurrences. */
|
||||
if (proceed && strcmp(word, answer) != 0) {
|
||||
@@ -2881,11 +2888,6 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
} else if (pid_spell < 0)
|
||||
return _("Could not fork");
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Block SIGWINCHes so the spell checker doesn't get any. */
|
||||
allow_sigwinch(FALSE);
|
||||
#endif
|
||||
|
||||
/* Wait for the alternate spell checker to finish. */
|
||||
wait(&alt_spell_status);
|
||||
|
||||
@@ -2940,11 +2942,6 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
adjust_viewport(STATIONARY);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Unblock SIGWINCHes again. */
|
||||
allow_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2957,7 +2954,7 @@ void do_spell(void)
|
||||
char *temp;
|
||||
unsigned stash[sizeof(flags) / sizeof(flags[0])];
|
||||
/* A storage place for the current flag settings. */
|
||||
const char *spell_msg;
|
||||
const char *result_msg;
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
show_restricted_warning();
|
||||
@@ -2991,10 +2988,9 @@ void do_spell(void)
|
||||
}
|
||||
|
||||
blank_bottombars();
|
||||
statusbar(_("Invoking spell checker, please wait"));
|
||||
|
||||
spell_msg = (alt_speller != NULL) ? do_alt_speller(temp) :
|
||||
do_int_speller(temp);
|
||||
result_msg = (alt_speller ? do_alt_speller(temp) : do_int_speller(temp));
|
||||
|
||||
unlink(temp);
|
||||
free(temp);
|
||||
|
||||
@@ -3005,12 +3001,12 @@ void do_spell(void)
|
||||
* sure that they're cleared off. */
|
||||
total_refresh();
|
||||
|
||||
if (spell_msg != NULL) {
|
||||
if (result_msg != NULL) {
|
||||
if (errno == 0)
|
||||
/* Don't display an error message of "Success". */
|
||||
statusline(ALERT, _("Spell checking failed: %s"), spell_msg);
|
||||
statusline(ALERT, _("Spell checking failed: %s"), result_msg);
|
||||
else
|
||||
statusline(ALERT, _("Spell checking failed: %s: %s"), spell_msg,
|
||||
statusline(ALERT, _("Spell checking failed: %s: %s"), result_msg,
|
||||
strerror(errno));
|
||||
} else
|
||||
statusbar(_("Finished checking spelling"));
|
||||
@@ -3027,8 +3023,10 @@ void do_linter(void)
|
||||
size_t parsesuccess = 0;
|
||||
int lint_status, lint_fd[2];
|
||||
pid_t pid_lint;
|
||||
bool helpless = ISSET(NO_HELP);
|
||||
static char **lintargs = NULL;
|
||||
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
|
||||
time_t last_wait = 0;
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
show_restricted_warning();
|
||||
@@ -3200,7 +3198,15 @@ void do_linter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (helpless && LINES > 4) {
|
||||
UNSET(NO_HELP);
|
||||
window_init();
|
||||
}
|
||||
|
||||
/* Show that we are in the linter now. */
|
||||
titlebar(NULL);
|
||||
bottombars(MLINTER);
|
||||
|
||||
tmplint = NULL;
|
||||
curlint = lints;
|
||||
|
||||
@@ -3228,11 +3234,12 @@ void do_linter(void)
|
||||
sprintf(msg, _("This message is for unopened file %s,"
|
||||
" open it in a new buffer?"), curlint->filename);
|
||||
i = do_yesno_prompt(FALSE, msg);
|
||||
currmenu = MLINTER;
|
||||
free(msg);
|
||||
|
||||
if (i == -1) {
|
||||
statusbar(_("Cancelled"));
|
||||
goto free_lints_and_return;
|
||||
break;
|
||||
} else if (i == 1) {
|
||||
open_buffer(curlint->filename, TRUE);
|
||||
} else {
|
||||
@@ -3263,8 +3270,7 @@ void do_linter(void)
|
||||
free(dontwantfile);
|
||||
|
||||
if (restlint == NULL) {
|
||||
statusbar(_("No more errors in unopened files, cancelling"));
|
||||
napms(2400);
|
||||
statusbar(_("No messages for this file"));
|
||||
break;
|
||||
} else {
|
||||
curlint = restlint;
|
||||
@@ -3284,7 +3290,7 @@ void do_linter(void)
|
||||
confirm_margin();
|
||||
#endif
|
||||
edit_refresh();
|
||||
statusbar(curlint->msg);
|
||||
statusline(NOTICE, curlint->msg);
|
||||
bottombars(MLINTER);
|
||||
}
|
||||
|
||||
@@ -3301,29 +3307,33 @@ void do_linter(void)
|
||||
func = func_from_key(&kbinput);
|
||||
tmplint = curlint;
|
||||
|
||||
if (func == do_cancel)
|
||||
if (func == do_cancel || func == do_enter) {
|
||||
wipe_statusbar();
|
||||
break;
|
||||
else if (func == do_help_void) {
|
||||
} else if (func == do_help_void) {
|
||||
tmplint = NULL;
|
||||
do_help_void();
|
||||
} else if (func == do_page_down) {
|
||||
if (curlint->next != NULL)
|
||||
curlint = curlint->next;
|
||||
else
|
||||
statusbar(_("At last message"));
|
||||
} else if (func == do_page_up) {
|
||||
} else if (func == do_page_up || func == do_prev_block) {
|
||||
if (curlint->prev != NULL)
|
||||
curlint = curlint->prev;
|
||||
else
|
||||
else if (last_wait != time(NULL)) {
|
||||
statusbar(_("At first message"));
|
||||
napms(600);
|
||||
last_wait = time(NULL);
|
||||
statusline(NOTICE, curlint->msg);
|
||||
}
|
||||
} else if (func == do_page_down || func == do_next_block) {
|
||||
if (curlint->next != NULL)
|
||||
curlint = curlint->next;
|
||||
else if (last_wait != time(NULL)) {
|
||||
statusbar(_("At last message"));
|
||||
napms(600);
|
||||
last_wait = time(NULL);
|
||||
statusline(NOTICE, curlint->msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wipe_statusbar();
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
free_lints_and_return:
|
||||
#endif
|
||||
for (curlint = lints; curlint != NULL;) {
|
||||
tmplint = curlint;
|
||||
curlint = curlint->next;
|
||||
@@ -3331,6 +3341,15 @@ void do_linter(void)
|
||||
free(tmplint->filename);
|
||||
free(tmplint);
|
||||
}
|
||||
|
||||
if (helpless) {
|
||||
SET(NO_HELP);
|
||||
window_init();
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
currmenu = MMOST;
|
||||
titlebar(NULL);
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
@@ -3368,7 +3387,7 @@ void do_wordlinechar_count(void)
|
||||
* count whenever we're on a word just before moving. */
|
||||
while (openfile->current != openfile->filebot ||
|
||||
openfile->current->data[openfile->current_x] != '\0') {
|
||||
if (do_next_word(FALSE, TRUE, FALSE))
|
||||
if (do_next_word(FALSE, TRUE))
|
||||
words++;
|
||||
}
|
||||
|
||||
|
||||
16
src/utils.c
16
src/utils.c
@@ -160,10 +160,9 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
}
|
||||
|
||||
/* Reduce the memory allocation of a string to what is needed. */
|
||||
void snuggly_fit(char **str)
|
||||
void snuggly_fit(char **string)
|
||||
{
|
||||
if (*str != NULL)
|
||||
*str = charealloc(*str, strlen(*str) + 1);
|
||||
*string = charealloc(*string, strlen(*string) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it. */
|
||||
@@ -266,13 +265,6 @@ bool is_separate_word(size_t position, size_t length, const char *buf)
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start)
|
||||
{
|
||||
if (*needle == '\0') {
|
||||
#ifndef NANO_TINY
|
||||
statusline(ALERT, "Searching for nothing -- please report a bug");
|
||||
#endif
|
||||
return (char *)start;
|
||||
}
|
||||
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
size_t last_find, ceiling, far_end;
|
||||
@@ -357,7 +349,7 @@ void *nmalloc(size_t howmuch)
|
||||
void *r = malloc(howmuch);
|
||||
|
||||
if (r == NULL && howmuch != 0)
|
||||
die(_("nano is out of memory!"));
|
||||
die(_("Nano is out of memory!\n"));
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -369,7 +361,7 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
void *r = realloc(ptr, howmuch);
|
||||
|
||||
if (r == NULL && howmuch != 0)
|
||||
die(_("nano is out of memory!"));
|
||||
die(_("Nano is out of memory!\n"));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
154
src/winio.c
154
src/winio.c
@@ -204,7 +204,7 @@ void read_keys_from(WINDOW *win)
|
||||
* check if errno is set to EIO ("Input/output error") and die in
|
||||
* that case, but it's not always set properly. Argh. */
|
||||
if (input == ERR && ++errcount == MAX_BUF_SIZE)
|
||||
die(_("Too many errors from stdin"));
|
||||
die(_("Too many errors from stdin\n"));
|
||||
}
|
||||
|
||||
curs_set(0);
|
||||
@@ -291,7 +291,7 @@ void unget_kbinput(int kbinput, bool metakey)
|
||||
void implant(const char *string)
|
||||
{
|
||||
for (int i = strlen(string); i > 0; i--)
|
||||
put_back(string[i - 1]);
|
||||
put_back((unsigned char)string[i - 1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -371,11 +371,6 @@ int parse_kbinput(WINDOW *win)
|
||||
keycode = *kbinput;
|
||||
free(kbinput);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "before parsing: keycode = %d, escapes = %d, digit_count = %d\n",
|
||||
keycode, escapes, digit_count);
|
||||
#endif
|
||||
|
||||
if (keycode == ERR)
|
||||
return ERR;
|
||||
|
||||
@@ -538,12 +533,18 @@ int parse_kbinput(WINDOW *win)
|
||||
return CONTROL_HOME;
|
||||
else if (retval == controlend)
|
||||
return CONTROL_END;
|
||||
#ifndef NANO_TINY
|
||||
else if (retval == controldelete)
|
||||
return CONTROL_DELETE;
|
||||
#ifndef NANO_TINY
|
||||
else if (retval == controlshiftdelete)
|
||||
return the_code_for(do_cut_prev_word, KEY_BACKSPACE);
|
||||
else if (retval == shiftcontrolleft) {
|
||||
return CONTROL_SHIFT_DELETE;
|
||||
else if (retval == shiftup) {
|
||||
shift_held = TRUE;
|
||||
return KEY_UP;
|
||||
} else if (retval == shiftdown) {
|
||||
shift_held = TRUE;
|
||||
return KEY_DOWN;
|
||||
} else if (retval == shiftcontrolleft) {
|
||||
shift_held = TRUE;
|
||||
return CONTROL_LEFT;
|
||||
} else if (retval == shiftcontrolright) {
|
||||
@@ -569,6 +570,8 @@ int parse_kbinput(WINDOW *win)
|
||||
return ALT_UP;
|
||||
else if (retval == altdown)
|
||||
return ALT_DOWN;
|
||||
else if (retval == altdelete)
|
||||
return ALT_DELETE;
|
||||
else if (retval == shiftaltleft) {
|
||||
shift_held = TRUE;
|
||||
return KEY_HOME;
|
||||
@@ -589,15 +592,31 @@ int parse_kbinput(WINDOW *win)
|
||||
* Shift/Ctrl/Alt are being held together with them. */
|
||||
unsigned char modifiers = 6;
|
||||
|
||||
/* Modifiers are: Alt (8), Ctrl (4), Shift (1). */
|
||||
if (on_a_vt && ioctl(0, TIOCLINUX, &modifiers) >= 0) {
|
||||
#ifndef NANO_TINY
|
||||
/* Is Delete pressed together with Shift or Shift+Ctrl? */
|
||||
if (retval == KEY_DC) {
|
||||
if (modifiers == 0x01)
|
||||
return SHIFT_DELETE;
|
||||
if (modifiers == 0x05)
|
||||
return CONTROL_SHIFT_DELETE;
|
||||
}
|
||||
/* Is Shift being held? */
|
||||
if (modifiers & 0x01) {
|
||||
/* A shifted <Tab> is a back tab. */
|
||||
if (retval == TAB_CODE)
|
||||
return SHIFT_TAB;
|
||||
shift_held = TRUE;
|
||||
}
|
||||
/* Is Alt being held? */
|
||||
if (modifiers == 0x08) {
|
||||
if (retval == KEY_DC)
|
||||
return ALT_DELETE;
|
||||
if (retval == KEY_UP)
|
||||
return ALT_UP;
|
||||
if (retval == KEY_DOWN)
|
||||
return ALT_DOWN;
|
||||
}
|
||||
#endif
|
||||
/* Is Ctrl being held? */
|
||||
if (modifiers & 0x04) {
|
||||
@@ -707,13 +726,8 @@ int parse_kbinput(WINDOW *win)
|
||||
return KEY_NPAGE;
|
||||
#ifdef KEY_SDC /* Slang doesn't support KEY_SDC. */
|
||||
case KEY_SDC:
|
||||
return KEY_BACKSPACE;
|
||||
return SHIFT_DELETE;
|
||||
#endif
|
||||
case DEL_CODE:
|
||||
if (ISSET(REBIND_DELETE))
|
||||
return the_code_for(do_delete, KEY_DC);
|
||||
else
|
||||
return KEY_BACKSPACE;
|
||||
#ifdef KEY_SIC /* Slang doesn't support KEY_SIC. */
|
||||
case KEY_SIC:
|
||||
return the_code_for(do_insertfile_void, KEY_IC);
|
||||
@@ -1096,17 +1110,33 @@ int convert_sequence(const int *seq, size_t length, int *consumed)
|
||||
if (length > 2 && seq[2] == '~')
|
||||
return KEY_DC;
|
||||
if (length > 4 && seq[2] == ';' && seq[4] == '~') {
|
||||
/* Esc [ 3 ; x ~ == modified Delete on xterm. */
|
||||
*consumed = 5;
|
||||
#ifndef NANO_TINY
|
||||
if (seq[3] == '2')
|
||||
/* Esc [ 3 ; 2 ~ == Shift-Delete on xterm/Terminal. */
|
||||
return SHIFT_DELETE;
|
||||
if (seq[3] == '3')
|
||||
/* Esc [ 3 ; 3 ~ == Alt-Delete on xterm/rxvt/Eterm/Terminal. */
|
||||
return ALT_DELETE;
|
||||
if (seq[3] == '5')
|
||||
/* Esc [ 3 ; 5 ~ == Ctrl-Delete on xterm. */
|
||||
return CONTROL_DELETE;
|
||||
if (seq[3] == '6')
|
||||
/* Esc [ 3 ; 6 ~ == Ctrl-Shift-Delete on xterm. */
|
||||
return controlshiftdelete;
|
||||
#endif
|
||||
}
|
||||
if (length > 2 && seq[2] == '^') {
|
||||
#ifndef NANO_TINY
|
||||
if (length > 2 && seq[2] == '$')
|
||||
/* Esc [ 3 $ == Shift-Delete on urxvt. */
|
||||
return SHIFT_DELETE;
|
||||
if (length > 2 && seq[2] == '^')
|
||||
/* Esc [ 3 ^ == Ctrl-Delete on urxvt. */
|
||||
*consumed = 3;
|
||||
return CONTROL_DELETE;
|
||||
}
|
||||
if (length > 2 && seq[2] == '@')
|
||||
/* Esc [ 3 @ == Ctrl-Shift-Delete on urxvt. */
|
||||
return controlshiftdelete;
|
||||
#endif
|
||||
break;
|
||||
case '4': /* Esc [ 4 ~ == End on VT220/VT320/
|
||||
* Linux console/xterm. */
|
||||
@@ -1310,12 +1340,15 @@ int parse_escape_sequence(WINDOW *win, int kbinput)
|
||||
/* If we got an unrecognized escape sequence, notify the user. */
|
||||
if (retval == ERR && win == edit) {
|
||||
/* TRANSLATORS: This refers to a sequence of escape codes
|
||||
* (from the keyboard) that nano does not recogize. */
|
||||
* (from the keyboard) that nano does not recognize. */
|
||||
statusline(ALERT, _("Unknown sequence"));
|
||||
suppress_cursorpos = FALSE;
|
||||
lastmessage = HUSH;
|
||||
if (currmenu == MMAIN) {
|
||||
place_the_cursor();
|
||||
#ifdef __NetBSD__
|
||||
wnoutrefresh(edit); /* Needed for correct placement on NetBSD. */
|
||||
#endif
|
||||
curs_set(1);
|
||||
}
|
||||
}
|
||||
@@ -1485,10 +1518,6 @@ int get_control_kbinput(int kbinput)
|
||||
else
|
||||
retval = kbinput;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "get_control_kbinput(): kbinput = %d, retval = %d\n", kbinput, retval);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1755,29 +1784,17 @@ const sc *get_shortcut(int *kbinput)
|
||||
{
|
||||
sc *s;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "after parsing: kbinput = %d, meta_key = %s -- ",
|
||||
*kbinput, meta_key ? "TRUE" : "FALSE");
|
||||
#endif
|
||||
|
||||
/* Plain characters cannot be shortcuts, so just skip those. */
|
||||
if (!meta_key && (*kbinput & 0x7F) >= 0x20 && *kbinput <= 0xFF)
|
||||
if (!meta_key && ((*kbinput >= 0x20 && *kbinput < 0x7F) ||
|
||||
(*kbinput >= 0xA0 && *kbinput <= 0xFF)))
|
||||
return NULL;
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next) {
|
||||
if ((s->menus & currmenu) && *kbinput == s->keycode &&
|
||||
meta_key == s->meta) {
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "matched seq '%s' (menu is %x from %x)\n",
|
||||
s->keystr, currmenu, s->menus);
|
||||
#endif
|
||||
meta_key == s->meta)
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "matched nothing\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2051,6 +2068,13 @@ void titlebar(const char *path)
|
||||
* then sacrifice the prefix, and only then start dottifying. */
|
||||
|
||||
/* Figure out the path, prefix and state strings. */
|
||||
#ifdef ENABLE_COLOR
|
||||
if (currmenu == MLINTER) {
|
||||
/* TRANSLATORS: The next four are "labels" in the title bar. */
|
||||
prefix = _("Linting --");
|
||||
path = openfile->filename;
|
||||
} else
|
||||
#endif
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (!inhelp && path != NULL)
|
||||
prefix = _("DIR:");
|
||||
@@ -2209,7 +2233,9 @@ void statusline(message_type importance, const char *msg, ...)
|
||||
else if (alerts < 4)
|
||||
beep();
|
||||
colorpair = interface_color_pair[ERROR_MESSAGE];
|
||||
} else
|
||||
} else if (importance == NOTICE)
|
||||
colorpair = interface_color_pair[SELECTED_TEXT];
|
||||
else
|
||||
colorpair = interface_color_pair[STATUS_BAR];
|
||||
|
||||
lastmessage = importance;
|
||||
@@ -2763,6 +2789,9 @@ int update_line(filestruct *fileptr, size_t index)
|
||||
if (strlenpt(fileptr->data) > from_col + editwincols)
|
||||
mvwaddch(edit, row, COLS - 1, '$');
|
||||
|
||||
if (spotlighted && !inhelp)
|
||||
spotlight(light_from_col, light_to_col);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2829,6 +2858,9 @@ int update_softwrapped_line(filestruct *fileptr)
|
||||
from_col = to_col;
|
||||
}
|
||||
|
||||
if (spotlighted && !inhelp)
|
||||
spotlight(light_from_col, light_to_col);
|
||||
|
||||
return (row - starting_row);
|
||||
}
|
||||
#endif
|
||||
@@ -3331,20 +3363,6 @@ void total_refresh(void)
|
||||
bottombars(currmenu);
|
||||
}
|
||||
|
||||
/* Display the main shortcut list on the last two rows of the bottom
|
||||
* portion of the window. */
|
||||
void display_main_list(void)
|
||||
{
|
||||
#if defined(ENABLE_COLOR) && defined(ENABLE_SPELLER)
|
||||
if (openfile->syntax && openfile->syntax->linter)
|
||||
set_linter_shortcut();
|
||||
else
|
||||
set_speller_shortcut();
|
||||
#endif
|
||||
|
||||
bottombars(MMAIN);
|
||||
}
|
||||
|
||||
/* Show info about the current cursor position on the statusbar.
|
||||
* Do this unconditionally when force is TRUE; otherwise, only if
|
||||
* suppress_cursorpos is FALSE. In any case, reset the latter. */
|
||||
@@ -3405,9 +3423,8 @@ void enable_waiting(void)
|
||||
nodelay(edit, FALSE);
|
||||
}
|
||||
|
||||
/* Highlight the text between from_col and to_col when active is TRUE.
|
||||
* Remove the highlight when active is FALSE. */
|
||||
void spotlight(bool active, size_t from_col, size_t to_col)
|
||||
/* Highlight the text between from_col and to_col. */
|
||||
void spotlight(size_t from_col, size_t to_col)
|
||||
{
|
||||
char *word;
|
||||
size_t word_span, room;
|
||||
@@ -3416,7 +3433,7 @@ void spotlight(bool active, size_t from_col, size_t to_col)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
spotlight_softwrapped(active, from_col, to_col);
|
||||
spotlight_softwrapped(from_col, to_col);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -3438,16 +3455,14 @@ void spotlight(bool active, size_t from_col, size_t to_col)
|
||||
if (word_span > room)
|
||||
room--;
|
||||
|
||||
if (active)
|
||||
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
|
||||
waddnstr(edit, word, actual_x(word, room));
|
||||
|
||||
if (word_span > room)
|
||||
waddch(edit, '$');
|
||||
|
||||
if (active)
|
||||
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
|
||||
free(word);
|
||||
|
||||
@@ -3455,10 +3470,9 @@ void spotlight(bool active, size_t from_col, size_t to_col)
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Highlight the text between from_col and to_col when active is TRUE; remove
|
||||
* the highlight when active is FALSE. This will not highlight softwrapped
|
||||
/* Highlight the text between the given columns. This will not highlight soft
|
||||
* line breaks, since they're not actually part of the spotlighted text. */
|
||||
void spotlight_softwrapped(bool active, size_t from_col, size_t to_col)
|
||||
void spotlight_softwrapped(size_t from_col, size_t to_col)
|
||||
{
|
||||
ssize_t row = openfile->current_y;
|
||||
size_t leftedge = leftedge_for(from_col, openfile->current);
|
||||
@@ -3485,13 +3499,11 @@ void spotlight_softwrapped(bool active, size_t from_col, size_t to_col)
|
||||
word = display_string(openfile->current->data, from_col,
|
||||
break_col - from_col, FALSE);
|
||||
|
||||
if (active)
|
||||
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
|
||||
waddnstr(edit, word, actual_x(word, break_col));
|
||||
|
||||
if (active)
|
||||
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||
|
||||
free(word);
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ color green "(\{|\}|\(|\)|\;|\]|\[|\\|<|>|!|=|&|\+|-|\*|%|/|\?:|\^|\|)"
|
||||
color brightyellow "\<(for|if|while|do|else|in|delete|exit)\>"
|
||||
color brightyellow "\<(break|continue|return)\>"
|
||||
# I/O statements.
|
||||
color brightgreen "\<(close|getline|next|nextfile|print|printf)\>"
|
||||
color brightgreen "\<(system|fflush)\>"
|
||||
color brightgreen "\<(close|fflush|getline|next|nextfile|print|printf|system)\>"
|
||||
# Standard functions.
|
||||
color magenta "\<(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\>"
|
||||
color magenta "\<(asort|asorti|gensub|gsub|index|length|match)\>"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
syntax changelog "Change[Ll]og[^/]*$"
|
||||
|
||||
# Author lines.
|
||||
color green "^(19|20).*$"
|
||||
color green "^(19|20).*"
|
||||
# Dates.
|
||||
color red "^(19|20)[0-9-]{8}"
|
||||
# Email addresses.
|
||||
|
||||
@@ -15,6 +15,5 @@ icolor brightred "^[[:space:]]*((end)?(function|macro)|return)"
|
||||
icolor cyan start="\$(\{|ENV\{)" end="\}"
|
||||
color magenta "\<(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\>"
|
||||
|
||||
icolor brightblue "^([[:space:]]*)?#.*"
|
||||
icolor brightblue "[[:space:]]#.*"
|
||||
color brightblue "(^|[[:space:]])#.*"
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -30,4 +30,4 @@ color blue ":(\w|[?-])+"
|
||||
color yellow start="^[[:blank:]]+\"" end="[^\]\""
|
||||
color yellow ""(\\.|[^"])*""
|
||||
# Comments
|
||||
color cyan "(^|[[:space:]]);.*$"
|
||||
color cyan "(^|[[:space:]]);.*"
|
||||
|
||||
@@ -39,7 +39,7 @@ color brightblue "\<tc-(arch(-kernel)?|export|has-(tls|openmp))\>"
|
||||
## Common commands used in ebuilds:
|
||||
color blue "\<(awk|cat|cd|chmod|chown|cp|echo|env|find|e?grep|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|tar|touch|unset|xargs)\>"
|
||||
## Comments (doesn't work that well):
|
||||
color yellow "(^|[[:space:]])#.*$"
|
||||
color yellow "(^|[[:space:]])#.*"
|
||||
## Strings (doesn't work that well):
|
||||
color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
|
||||
## Trailing space is bad!
|
||||
@@ -52,7 +52,7 @@ syntax /etc/portage "\.(accept_keywords|env|keywords|mask|unmask|use)(/.+)?$"
|
||||
comment "#"
|
||||
|
||||
## Base text:
|
||||
color green "^.+$"
|
||||
color green ".+"
|
||||
## Likely version and slot numbers:
|
||||
color magenta "-[[:digit:].]+(_(alpha|beta|pre|rc|p)[[:digit:]]*)*(-r[[:digit:]]+)?([:[:space:]]|$)"
|
||||
color magenta ":[^[:space:]]+([[:space:]]|$)"
|
||||
@@ -67,7 +67,7 @@ color cyan "^[[:space:]]*[^/]*/"
|
||||
## Masking regulators:
|
||||
color brightmagenta "^[[:space:]]*(=|~|<|<=|>|>=)"
|
||||
## Comments:
|
||||
color yellow "#.*$"
|
||||
color yellow "#.*"
|
||||
## Trailing space is bad!
|
||||
color ,green "[[:space:]]+$"
|
||||
## Mixed whitespace is also bad.
|
||||
|
||||
@@ -15,7 +15,7 @@ color cyan start="(\\|\\\\)n\[" end="]"
|
||||
# Requests
|
||||
color brightgreen "^\.[[:space:]]*[^[:space:]]*"
|
||||
# Comments
|
||||
color yellow "^\.\\".*$"
|
||||
color yellow "^\.\\".*"
|
||||
# Strings
|
||||
color green "(\\|\\\\)\*(.|\(..)"
|
||||
color green start="(\\|\\\\)\*\[" end="]"
|
||||
|
||||
@@ -21,4 +21,4 @@ color blue "#?:(\w|[?-])+"
|
||||
color yellow start="^[[:blank:]]+\"" end="[^\]\""
|
||||
color yellow ""(\\.|[^"])*""
|
||||
# Comments
|
||||
color cyan "(^|[[:space:]]);.*$"
|
||||
color cyan "(^|[[:space:]]);.*"
|
||||
|
||||
@@ -28,7 +28,7 @@ color brightred "\{" "\}"
|
||||
color brightred "," ":"
|
||||
|
||||
# Comments.
|
||||
color cyan "(^|[[:space:]]+)(//|#).*$"
|
||||
color cyan "(^|[[:space:]]+)(//|#).*"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -4,15 +4,15 @@ syntax man "\.[1-9]x?$"
|
||||
magic "troff or preprocessor input"
|
||||
comment ".\""
|
||||
|
||||
color green "\.(SH|SS|TH) .*$"
|
||||
color green "\.(SH|SS|TH) .*"
|
||||
color brightgreen "\.(SH|SS|TH) " "\.([HIT]P)"
|
||||
color brightred "\.(B[IR]?|I[BR]?|R[BI]|S[BM]) .*$"
|
||||
color brightred "\.(B[IR]?|I[BR]?|R[BI]|S[BM]) .*"
|
||||
color brightblue "\.(B[IR]?|I[BR]?|R[BI]|S[BM]) " "\.([LP]?P)$"
|
||||
color magenta "\\f[BIPR]"
|
||||
color yellow "\.(br|DT|RS|RE|PD)"
|
||||
|
||||
# Comments.
|
||||
color cyan "\.?\\\".*$"
|
||||
color cyan "\.?\\\".*"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -4,7 +4,6 @@ syntax mgp "\.mgp$"
|
||||
header "^%include.*"
|
||||
comment "#"
|
||||
|
||||
icolor green "^%[a-z].*$"
|
||||
color cyan "(^|[[:space:]])#.*$"
|
||||
color cyan "(^|[[:space:]])%%.*$"
|
||||
icolor green "^%[a-z].*"
|
||||
color cyan "(^|[[:space:]])(#|%%).*"
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -5,7 +5,7 @@ syntax nanohelp
|
||||
|
||||
# Key combos:
|
||||
color cyan "\^[]4-8A-Z^\_◀▶▲▼]" "[◀▶▲▼]" "\<M-." "\<F1?[0-9]"
|
||||
color cyan "\<(Tab|Sh-Tab|Enter|Ins|Del|Space|Bsp|Up|Down|Left|Right|Home|End|PgUp|PgDn)\>"
|
||||
color cyan "\<((Sh-)?Tab|Enter|Ins|(Sh-\^?)?Del|Space|Bsp|Up|Down|Left|Right|Home|End|PgUp|PgDn)\>"
|
||||
|
||||
# Quoted indicators:
|
||||
color brightred "'(\^|M-)'"
|
||||
|
||||
@@ -4,15 +4,15 @@ syntax nanorc "\.?nanorc$"
|
||||
comment "#"
|
||||
|
||||
# Possible errors and parameters
|
||||
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|i?color|extendsyntax).*$"
|
||||
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|i?color|extendsyntax).*"
|
||||
|
||||
# Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds)\>"
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds|zap)\>"
|
||||
icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
|
||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
|
||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter)[[:space:]]+.*$"
|
||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter)[[:space:]]+.*"
|
||||
icolor brightgreen "^[[:space:]]*(syntax|linter)[[:space:]]+[^[:blank:]]+"
|
||||
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|extendsyntax)\>"
|
||||
|
||||
@@ -24,8 +24,8 @@ icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|gr
|
||||
icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
|
||||
# Comments
|
||||
color brightblue "(^|[[:space:]]+)#.*$"
|
||||
color cyan "^[[:space:]]*##.*$"
|
||||
color brightblue "(^|[[:space:]]+)#.*"
|
||||
color cyan "^[[:space:]]*##.*"
|
||||
|
||||
# Trailing whitespace
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -17,7 +17,7 @@ color red "\<(drop|reject)\>"
|
||||
color brightblue "\<(accept|continue|(d|s)nat|goto|jump|masquerade|return)\>"
|
||||
|
||||
# Comments
|
||||
color cyan "(^|[[:space:]])#.*$"
|
||||
color cyan "(^|[[:space:]])#.*"
|
||||
|
||||
# Trailing whitespace
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -38,5 +38,5 @@ color brightblue "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|
|
||||
color yellow "//.*"
|
||||
color yellow start="/\*" end="\*/"
|
||||
|
||||
# Trailing whitespace.
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -26,4 +26,4 @@ color cyan "\\[abcefnrtv"\]"
|
||||
# Reminders.
|
||||
color brightwhite,yellow "(FIXME|TODO|XXX)"
|
||||
# Obsolete strings.
|
||||
color red "#~.*$"
|
||||
color red "#~.*"
|
||||
|
||||
@@ -59,9 +59,8 @@ color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>"
|
||||
color green "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
|
||||
|
||||
# Comments.
|
||||
color red "#[^{].*$" "#$"
|
||||
color red "--[^{].*$" "#$"
|
||||
color red "##[^{].*$" "##$"
|
||||
color red "##?[^{].*" "##?$"
|
||||
color red "--[^{].*" "--$"
|
||||
color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
|
||||
|
||||
@@ -10,9 +10,14 @@ comment "#"
|
||||
icolor brightblue "def [0-9A-Z_]+"
|
||||
# Keywords.
|
||||
color brightcyan "\<(and|as|assert|async|await|break|class|continue)\>"
|
||||
color brightcyan "\<(def|del|elif|else|except|exec|finally|for|from)\>"
|
||||
color brightcyan "\<(def|del|elif|else|except|finally|for|from)\>"
|
||||
color brightcyan "\<(global|if|import|in|is|lambda|nonlocal|not|or)\>"
|
||||
color brightcyan "\<(pass|print|raise|return|try|while|with|yield)\>"
|
||||
color brightcyan "\<(pass|raise|return|try|while|with|yield)\>"
|
||||
|
||||
# These two are keywords in Python 2, but functions in Python 3,
|
||||
# so only color them when they are followed by whitespace, assuming
|
||||
# that print(x) is a function invocation and print (x) is a statement.
|
||||
color brightcyan "\<(exec|print)([[:blank:]]|$)"
|
||||
|
||||
# Special values.
|
||||
color brightmagenta "\<(False|None|True)\>"
|
||||
@@ -21,7 +26,7 @@ color brightmagenta "\<(False|None|True)\>"
|
||||
color brightgreen "'([^'\]|\\.)+'"
|
||||
color brightgreen ""([^"\]|\\.)+""
|
||||
# Comments.
|
||||
color brightred "(^|[[:blank:]])#.*$"
|
||||
color brightred "(^|[[:blank:]])#.*"
|
||||
# Triple-quoted strings.
|
||||
color brightgreen start="'''([^'),]|$)" end="(^|[^(\])'''"
|
||||
color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(\])\"\"\""
|
||||
|
||||
@@ -28,8 +28,8 @@ color brightgreen "#\{[^}]*\}"
|
||||
# Strings, single-quoted.
|
||||
color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
|
||||
# Comments.
|
||||
color cyan "#[^{].*$" "#$"
|
||||
color brightcyan "##[^{].*$" "##$"
|
||||
color cyan "#[^{].*" "#$"
|
||||
color brightcyan "##[^{].*" "##$"
|
||||
# "Here" docs.
|
||||
color green start="<<-?'?EOT'?" end="^EOT"
|
||||
# Some common markers.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Here is an example for Bourne shell scripts.
|
||||
|
||||
syntax sh "(\.sh|\.(a|ba|c|da|k|mk|pdk|tc|z)(sh|shrc|sh_profile)|/(etc/|\.)profile)$"
|
||||
header "^#!.*/(((a|ba|c|da|k|mk|pdk|tc|z)?sh)|openrc-run|runscript)"
|
||||
header "^#!.*/(((a|ba|c|da|k|mk|pdk|tc|z)?sh)|(busybox|env) +sh|openrc-run|runscript)"
|
||||
magic "(POSIX|Bourne-Again) shell script.*text"
|
||||
linter dash -n
|
||||
comment "#"
|
||||
@@ -28,7 +28,7 @@ color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
|
||||
color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
|
||||
|
||||
# Comments.
|
||||
color cyan "(^|[[:space:]])#.*$"
|
||||
color cyan "(^|[[:space:]])#.*"
|
||||
|
||||
# Strings.
|
||||
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
|
||||
|
||||
@@ -31,7 +31,7 @@ color red "^%(post|posttrans|postun|trigger|triggerin|triggerpostun|triggerun|ve
|
||||
color brightred "%(if|else|endif|define|global|undefine)"
|
||||
|
||||
# Comments.
|
||||
color cyan "#.*$"
|
||||
color cyan "#.*"
|
||||
# Special case: "# norootforbuild" is handled as main tag.
|
||||
color brightblue "^# norootforbuild"
|
||||
# %changelog date entries.
|
||||
|
||||
@@ -12,10 +12,10 @@ color brightmagenta "@[a-zA-Z]+\{[^}]*\}"
|
||||
color yellow "@[a-zA-Z]+\{?" "\}"
|
||||
|
||||
# Menu items.
|
||||
color brightred "^\*[[:space:]]+.*::.*$"
|
||||
color brightred "^\*[[:space:]]+.*::.*"
|
||||
|
||||
# Comments.
|
||||
color green "@c[[:space:]]+.*$"
|
||||
color green "@c[[:space:]]+.*"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
Reference in New Issue
Block a user