Added SILC Thread Queue API
[runtime.git] / apps / irssi / src / fe-text / textbuffer.c
index 8ac8bf0043efdb0fa7d3c8f40d2c5886efe9a213..930e55ad6d205365adc909c808232f313243c5ef 100644 (file)
@@ -18,6 +18,8 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#define        G_LOG_DOMAIN "TextBuffer"
+
 #include "module.h"
 #include "misc.h"
 #include "formats.h"
@@ -111,15 +113,16 @@ static void text_chunk_line_free(TEXT_BUFFER_REC *buffer, LINE_REC *line)
 {
        TEXT_CHUNK_REC *chunk;
        const unsigned char *text;
-        unsigned char *tmp = NULL;
+        unsigned char cmd, *tmp = NULL;
 
        for (text = line->text;; text++) {
                if (*text != '\0')
                         continue;
 
                text++;
-               if (*text == LINE_CMD_CONTINUE || *text == LINE_CMD_EOL) {
-                       if (*text == LINE_CMD_CONTINUE)
+               cmd = *text;
+               if (cmd == LINE_CMD_CONTINUE || cmd == LINE_CMD_EOL) {
+                       if (cmd == LINE_CMD_CONTINUE)
                                memcpy(&tmp, text+1, sizeof(char *));
 
                        /* free the previous block */
@@ -131,10 +134,12 @@ static void text_chunk_line_free(TEXT_BUFFER_REC *buffer, LINE_REC *line)
                                        text_chunk_destroy(buffer, chunk);
                        }
 
-                       if (*text == LINE_CMD_EOL)
+                       if (cmd == LINE_CMD_EOL)
                                break;
 
                        text = tmp-1;
+               } else if (cmd == LINE_CMD_INDENT_FUNC) {
+                       text += sizeof(int (*) ());
                }
        }
 }
@@ -518,7 +523,8 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
                         textbuffer_line_ref(line);
                        matches = g_list_append(matches, line);
 
-                       if (!line_matched && --match_after == 0)
+                       if ((!line_matched && --match_after == 0) ||
+                           (line_matched && match_after == 0 && before > 0))
                                matches = g_list_append(matches, NULL);
                }
        }