Revision: 918
http://svn.sourceforge.net/geany/?rev=918&view=rev
Author: eht16
Date: 2006-10-22 10:30:24 -0700 (Sun, 22 Oct 2006)
Log Message:
-----------
Added shebang detection for D files (dmd).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/filetypes.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-10-22 16:52:42 UTC (rev 917)
+++ trunk/ChangeLog 2006-10-22 17:30:24 UTC (rev 918)
@@ -8,6 +8,7 @@
* src/sci_cb.c, src/sci_cb.h, src/search.c:
Let the Find, Replace and FIF dialogs use the word at current cursor
position if there is no selection.
+ * src/filetypes.c: Added shebang detection for D files (dmd).
2006-10-22 Nick Treleaven <nick.treleaven(a)btinternet.com>
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2006-10-22 16:52:42 UTC (rev 917)
+++ trunk/src/filetypes.c 2006-10-22 17:30:24 UTC (rev 918)
@@ -725,6 +725,8 @@
ft = filetypes[GEANY_FILETYPES_SH];
else if (strncmp(basename_interpreter, "csh", 3) == 0)
ft = filetypes[GEANY_FILETYPES_SH];
+ else if (strncmp(basename_interpreter, "dmd", 3) == 0)
+ ft = filetypes[GEANY_FILETYPES_D];
// what else to add?
g_free(basename_interpreter);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 917
http://svn.sourceforge.net/geany/?rev=917&view=rev
Author: eht16
Date: 2006-10-22 09:52:42 -0700 (Sun, 22 Oct 2006)
Log Message:
-----------
Let the Find, Replace and FIF dialogs use the word at current cursor position if there is no selection.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/sci_cb.c
trunk/src/sci_cb.h
trunk/src/search.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-10-22 16:38:04 UTC (rev 916)
+++ trunk/ChangeLog 2006-10-22 16:52:42 UTC (rev 917)
@@ -5,6 +5,9 @@
* geany.glade, src/interface.c, src/geany.h, src/keyfile.c,
src/main.c: Removed previously added configuration option and
removed the right alignment of the toolbar quit button.
+ * src/sci_cb.c, src/sci_cb.h, src/search.c:
+ Let the Find, Replace and FIF dialogs use the word at current cursor
+ position if there is no selection.
2006-10-22 Nick Treleaven <nick.treleaven(a)btinternet.com>
Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c 2006-10-22 16:38:04 UTC (rev 916)
+++ trunk/src/sci_cb.c 2006-10-22 16:52:42 UTC (rev 917)
@@ -450,14 +450,22 @@
}
+/* Reads the word at given cursor position and writes it into the given buffer. The buffer will be
+ * NULL terminated in any case, even when the word is truncated because wordlen is too small.
+ * position can be -1, then the current position is used. */
void sci_cb_find_current_word(ScintillaObject *sci, gint pos, gchar *word, size_t wordlen)
{
- gint line = sci_get_line_from_position(sci, pos);
- gint line_start = sci_get_position_from_line(sci, line);
- gint startword = pos - line_start;
- gint endword = pos - line_start;
+ gint line, line_start, startword, endword;
gchar *chunk;
+ if (pos == -1)
+ pos = sci_get_current_position(sci);
+
+ line = sci_get_line_from_position(sci, pos);
+ line_start = sci_get_position_from_line(sci, line);
+ startword = pos - line_start;
+ endword = pos - line_start;
+
word[0] = '\0';
chunk = sci_get_line(sci, line);
Modified: trunk/src/sci_cb.h
===================================================================
--- trunk/src/sci_cb.h 2006-10-22 16:38:04 UTC (rev 916)
+++ trunk/src/sci_cb.h 2006-10-22 16:52:42 UTC (rev 917)
@@ -65,6 +65,9 @@
gboolean sci_cb_handle_xml(ScintillaObject *sci, gchar ch);
+/* Reads the word at given cursor position and writes it into the given buffer. The buffer will be
+ * NULL terminated in any case, even when the word is truncated because wordlen is too small.
+ * position can be -1, then the current position is used. */
void sci_cb_find_current_word(ScintillaObject *sci, gint pos, gchar *word, size_t wordlen);
gboolean sci_cb_show_calltip(gint idx, gint pos);
Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c 2006-10-22 16:38:04 UTC (rev 916)
+++ trunk/src/search.c 2006-10-22 16:52:42 UTC (rev 917)
@@ -31,6 +31,7 @@
#include "document.h"
#include "sciwrappers.h"
#include "ui_utils.h"
+#include "sci_cb.h"
#include <unistd.h>
#include <string.h>
@@ -206,6 +207,26 @@
#endif
+static gchar *get_default_text(gint idx)
+{
+ gchar *s = NULL;
+
+ if (sci_get_lines_selected(doc_list[idx].sci) == 1)
+ {
+ s = g_malloc(sci_get_selected_text_length(doc_list[idx].sci));
+ sci_get_selected_text(doc_list[idx].sci, s);
+ }
+ else if (sci_get_lines_selected(doc_list[idx].sci) == 0)
+ { // use the word at current cursor position
+ static gchar word[GEANY_MAX_WORD_LENGTH];
+ sci_cb_find_current_word(doc_list[idx].sci, -1, word, sizeof(word));
+ if (word[0] != '\0') s = g_strdup(word);
+ }
+
+ return s;
+}
+
+
void search_show_find_dialog()
{
gint idx = document_get_cur_idx();
@@ -213,11 +234,7 @@
if (idx == -1 || ! doc_list[idx].is_valid) return;
- if (sci_get_lines_selected(doc_list[idx].sci) == 1)
- {
- sel = g_malloc(sci_get_selected_text_length(doc_list[idx].sci));
- sci_get_selected_text(doc_list[idx].sci, sel);
- }
+ sel = get_default_text(idx);
if (widgets.find_dialog == NULL)
{
@@ -281,11 +298,7 @@
if (idx == -1 || ! doc_list[idx].is_valid) return;
- if (sci_get_lines_selected(doc_list[idx].sci) == 1)
- {
- sel = g_malloc(sci_get_selected_text_length(doc_list[idx].sci));
- sci_get_selected_text(doc_list[idx].sci, sel);
- }
+ sel = get_default_text(idx);
if (widgets.replace_dialog == NULL)
{
@@ -547,11 +560,7 @@
gtk_widget_show_all(widgets.find_in_files_dialog);
}
- if (sci_get_lines_selected(doc_list[idx].sci) == 1)
- {
- sel = g_malloc(sci_get_selected_text_length(doc_list[idx].sci));
- sci_get_selected_text(doc_list[idx].sci, sel);
- }
+ sel = get_default_text(idx);
entry2 = GTK_BIN(combo)->child;
if (sel) gtk_entry_set_text(GTK_ENTRY(entry2), sel);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.