summaryrefslogtreecommitdiffstats
path: root/usr.bin/mg/search.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* When in incremental search handle ^M (a.k.a. <cr>) like ^[ (a.k.a.krw2018-07-111-5/+5
| | | | | | | <esc>). i.e. exit incremental search and set the mark. This is what emacs does. pointers, suggestions and ok florian@
* Present the default choice before the colon in prompts. Matches GNU Emacsbcallah2017-08-061-2/+2
| | | | | | | | behavior. From Scott Cheloha <scottcheloha@gmail.com> ok florian@
* fix -Wshadow warnings.florian2017-05-301-8/+8
| | | | Found by bcallah, thanks!
* Clean up the includes in mg.bcallah2015-03-191-3/+6
| | | | | | | | | | This does the following: Moves all POSIX headers from sysdef.h into the individual .c files so that each file now only includes what it needs. All headers are properly sorted. Moves the remainder of sysdef.h to other files (mostly def.h) and deletes sysdef.h now that it's no longer contains anything. Tweak a comment that references sysdef.h so that it no longer does that. ok florian@
* Add some missing dobeeps.lum2014-03-201-1/+9
| | | | ok florian@
* Make the system bell toggleable via 'audible-bell', and if switchedlum2013-05-311-14/+14
| | | | | | off, make available an alternative 'visible-bell'. ok florian@ jasper@ Feedback Sunil Nimmagadda.
* Make C-r not screw up the line counter if the pattern ends up notlum2012-09-071-3/+6
| | | | | | matching. More goodness from Florian Obser. (and a tweak by me)
* Allow searching (C-s or C-r) to wrap around the ends of a buffer.lum2012-05-251-17/+25
| | | | | Even if the search string is located at the beginning or end of a buffer.
* Remove the conditional directives NO_MACRO and NO_STARTUP.lum2012-04-121-7/+1
| | | | | They have not compiled for numerous years. ok kjell@ millert@
* It volates style(9), but in mg, #include"def.h" goes first. 'twas the way it was built. no binary change here. confirmed by lum@, tested by Henri Kemppainenkjell2011-01-211-1/+2
|
* Rename w_flag to w_rflag. This is not a general purposekjell2009-06-041-9/+9
| | | | | | | flag: it is for redisplay options only. I need an additional all-purpose flag, so renaming removes the desire to wrongly overload the existing one. Turdshine. No functional chage.
* incremental search isn't allowed in macros, so if your fingerskjell2008-06-121-3/+11
| | | | | | | | | | | automatically go there during a macro def, the macro recording is CANCELED. This sucks rocks. This fixes the incremental searches to automagically invoke the non-incremental varieties during macro recording and playback. ok art
* Fix a problem with wrapped incremental searches.kjell2007-02-131-19/+17
| | | | | | | | | Basically, on wrap, the line pointer and offset would get out of sync, leading to incorrect line numbers or a segfault. Deanna Phillips did all the work of spotting it tracking it down to the right function. Thanks! While here, add emacs-like messages for wrapped and failed incremental searches. Tested by Deanna.
* 1. Fix line numbering/mark line bug in isearch.kjell2006-11-181-4/+12
| | | | | | | To reproduce, set mark, move, isearch, then swap mark and point. 2. store mark in save structure (to reproduce search on a pattern twice, then backspace to back up the search stack) Both from Peter De Wachter (debian bug#391827) Thanks!
* fix a segfault on isearch. Using ^W to add more than NPAT chars to thekjell2006-11-171-7/+11
| | | | | | search pattern had an off-by-one. Fix this and one other irritating behavior with long search patterns. Noted (similar diff proposed) and tested by deanna phillips
* Add bfirstlp(), blastlp() macros, returning the first and last lineskjell2006-07-251-3/+3
| | | | | | of a buffer respectively. Removes an ugly construction than necessitated "go to first line"-type comments throughout the code. No binary change
* Rename the header line of a buffer to b_headp, from the remarkablykjell2006-07-251-7/+7
| | | | unintuitive b_linep. No binary change.
* Display line number in the mg statusbar. Yes, it seems like a fuglykjell2006-06-011-4/+22
| | | | | | | | | | way to do it, but all the clever and pretty ways utterly failed. Basic use seems fine. We'll turdshine the special cases later. If it bothers you, use M-x line-number-mode, or put same in your ~/.mg file to disable. ok cloder, jason
* Make Window Flags more mnemonic (and less dumb); i.e.kjell2006-05-281-3/+3
| | | | | | WFHARD -> WFFULL (Redraw full window) WFFORCE -> WFFRAME (Reframe window). No binary change
* Fix off by one ocurring if ^W immediate follows ^S; testing marc@;otto2006-02-031-1/+3
| | | | ok kjell@; PR 4991
* More name-clash delintingkjell2005-12-131-2/+5
|
* do some silly de-lintingkjell2005-12-131-2/+2
|
* greedy use of typedef struct was making code harder to read; ok kjell cloderderaadt2005-11-181-9/+9
|
* Casefold on replace was killed ages ago (it was wrong). Remove akjell2005-11-181-5/+5
| | | | leftover (unused) variable.
* Allow the more traditional emacs keybindings during search/replace, tookjell2005-10-111-10/+11
| | | | | (i.e. 'y' to accept, 'n' to skip, and <CR> to end) ok deraadt@, cloder@
* Clean up eread handling in mg. (basically, fallout from the 'enter oftenkjell2005-08-091-4/+4
| | | | | | | | | means abort' behaviour added during the hackathon). Eliminates redundant ereply function, fixes miscellaneous cores when aborting, and move a number of assumed pathnames into the prompt text, since they are used there anyway. All changes consistent with emacs behavior ok beck@ many, many moons ago.
* Add explicit public domain notices to all public domain files.kjell2005-06-141-1/+3
| | | | ok millert@, deraadt@
* Three more ereply that should be ereads. This fixes henning's "replacekjell2005-06-141-3/+5
| | | | | | with null string is busted" observation. ok henning@, cloder@
* if functions permits null reply from minibuffer, use eread (withkjell2005-06-051-2/+3
| | | | | EFNUL), not ereply. ok cloder
* Like emacs, handle ^W during incremental search. Pressing ^W duringcloder2005-06-031-2/+41
| | | | | search will add the rest of the word from the current buffer to the pattern buffer. Testing and comments by kjell and marc
* Add emacs-style replace-string function that does not prompt youcloder2005-05-271-1/+39
| | | | | to confirm replacements. OK jason, deraadt
* Fix dumb bug in initial prompt for search-forwardcloder2005-05-271-2/+2
| | | | OK jason, kjell
* Do not dump core if user hits ^g to exit minibuffer from search-forward.cloder2005-05-271-3/+5
| | | | Found by deraadt, ok kjell
* Incremental search will now wrap to beginning (or end if backwards) ifcloder2005-05-251-3/+23
| | | | you hit the search key again after a failure. OK jason
* make ^S/^R behave like 'emacs': mixed case patterns forces a case sensitivejason2005-05-231-9/+17
| | | | search. all lower case patterns is a case insensitive search; ok art
* This is a no binary change which does:db2005-04-031-41/+40
| | | | | | | | | | - spelling, punctuation fixes - variable declaration lineup - use parentheses for return and sizeof - K&R function declarations -> ANSI - other minor code beautification ok henning@
* stage 1 of the infinite minibuffer work - add support for on the flyvincent2004-07-221-14/+16
| | | | | | | buffer reallocation in veread(). This commit only changes the API. All the buffers have exactly the same bounds as before for now. tested by a couple of my very helpful testers!
* Finish KNF of prototypes. That should be all of them.cloder2003-05-201-35/+21
| | | | OK vincent@
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-161-11/+11
|
* * Replace unsafe strcpy and strcat calls to safe strlcpy and strlcat.vincent2002-02-131-4/+4
| | | | | | | * Be a little bit more verbose about some errors * Fix some memory leaks in fileio.c ok deraadt@, art@
* spacesmickey2001-05-241-23/+23
|
* remove VOID. We're way beyond the point where this could build with anart2001-05-231-24/+24
| | | | ancient compiler.
* Fix another annoying feature in mg. When I try to use the keypad toart2001-05-031-1/+9
| | | | | | | | | | | | escape from I-search (I don't know if it's legal, but it works in emacs) the initial ESC in the sequence is caugth by I-search (which exits), but not the rest of it which ends up written into the buffer. This is extra annoying when we don't have undo. Note that this is better than emacs because the ESC is removed if nothing indicating a multi-char sequence comes within 300 miliseconds. (Try to ESC from I-search in emacs and then press 'x').
* $OpenBSD$niklas2001-01-291-0/+2
|
* More -Wall anmd KNF, from op2@tomahawk.SQUiSH.orgmillert2000-09-011-152/+147
|
* The start of KNF + -Wall. The code has been run through indent butmillert2000-04-131-133/+161
| | | | needs hand fixup. I stopped at keymap.c...
* initial import of mg2aderaadt2000-02-251-0/+664