diff --git a/README.md b/README.md index 4da7f83..5febafa 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,9 @@ fixing it would have been a lost cause, if not for Cscope itself. Well, Csope no + saved kilobytes by stripping trailing whitespace + FILE\* refsfound used to be rewind()-ed everytime the reads were not sequencial +# Control flow +... + # Project structure /*probably move to documentation*/ | Component | Purpose | | :-------: | :-----: | @@ -76,6 +79,12 @@ fixing it would have been a lost cause, if not for Cscope itself. Well, Csope no | readline.c | all functions directly dealing with GNU Readline; responsible for line editing in *input mode* | | help.c | all functions dealing with help messages | +# Key Symbols +| Global | Role | +| :----: | :--: | +| int input_mode | Responsible of keeping track how current input should be handled. Not only does the readline handler depend on it, its also used to determine what types of inputs all legal (e.g. swapping to another window). Takes up on of the values of the INPUT_\* macros. +| int window_change | Bit mask type of the CH_\* macros. Keeps track of the windows to be refresed on the next run of display(). Could be better utalized. + # TODO /*move soon*/ + sort out constants.h + scrollbar() uses magic int literals? @@ -85,6 +94,7 @@ fixing it would have been a lost cause, if not for Cscope itself. Well, Csope no + sort out the global hell + was there really ever a scrollbar? + handle resizing + + a search struct could be great for caching and could easy the global situation ## Original + Same capabilities as interactive in non interactive (one shot) mode + Provide some how-do-I-use-this-thing doc. @@ -95,6 +105,7 @@ fixing it would have been a lost cause, if not for Cscope itself. Well, Csope no free(): double free detected in tcache 2 Aborted + Changing text can crash without replacing text and leaving the console ncursed + + After an attempted change malloc *can* cry and crash # Future features / contributor wishlist + providing support for other languages by integrating new lexers (e.g. ctag's) diff --git a/src/build.c b/src/build.c index b388a19..dbd6ec3 100644 --- a/src/build.c +++ b/src/build.c @@ -17,11 +17,11 @@ without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS - IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO, + IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT LIMITED TO, PROCUREMENT OF + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT diff --git a/src/command.c b/src/command.c index be09d73..7bb0e72 100644 --- a/src/command.c +++ b/src/command.c @@ -67,7 +67,6 @@ char newpat[PATLEN + 1]; /* new pattern */ static void scrollbar(MOUSE *p); /* read references from a file */ - bool readrefs(char *filename) { FILE *file; int c; @@ -148,7 +147,7 @@ void countrefs(void) { /* count the references found and find the length of the file, function, and line number display fields */ - /* HBB falseTE 2012-04-07: it may look like we shouldn't assing tempstring here, + /* HBB NOTE 2012-04-07: it may look like we shouldn't assing tempstring here, * since it's not used. But it has to be assigned just so the return value * of fscanf will actually reach 4. */ while(EOF != (i = fscanf(refsfound, diff --git a/src/display.c b/src/display.c index 84e4286..dca8765 100644 --- a/src/display.c +++ b/src/display.c @@ -600,6 +600,8 @@ static inline void display_cursor(void) { } void horswp_field(void) { + if(input_mode != INPUT_NORMAL){ return; } + if(current_window != &wresult) { if(totallines == 0) { return; } if(current_window == &winput) { @@ -613,6 +615,7 @@ void horswp_field(void) { current_window = last_window; if(current_window == &winput) { window_change |= CH_INPUT; } } + window_change |= CH_RESULT; } diff --git a/src/input.c b/src/input.c index a5376f1..fffc894 100644 --- a/src/input.c +++ b/src/input.c @@ -410,6 +410,9 @@ int change_input(const int c) { break; case ctrl('D'): changestring(input_line, newpat, change, totallines); + input_mode = INPUT_NORMAL; + horswp_field(); + search(newpat); break; default: { @@ -506,9 +509,7 @@ int changestring(const char *from, const char *to, const bool *const change, fflush(script); /* edit the files */ - fprintf(stderr, "Changed lines:\n\r"); - execute("sh", "sh", temp2, NULL); - askforchar(); + execute("sh", "sh", temp2, NULL); // XXX: this should not echo end: fclose(script); return true;