48
51
gint len = SSM(sci, SCI_GETLINECOUNT, 0, 0);
51
g_snprintf(tmp_str, 15, "_%d%d", len, extra_width);
54
g_snprintf(tmp_str, 15, "_%d", len);
52
55
width = sci_text_width(sci, STYLE_LINENUMBER, tmp_str);
53
SSM (sci, SCI_SETMARGINWIDTHN, 0, width);
54
SSM (sci, SCI_SETMARGINSENSITIVEN, 0, FALSE); /* use default behaviour */
58
g_snprintf(tmp_str, 15, "%d", extra_width);
59
width += sci_text_width(sci, STYLE_LINENUMBER, tmp_str);
61
SSM(sci, SCI_SETMARGINWIDTHN, 0, width);
62
SSM(sci, SCI_SETMARGINSENSITIVEN, 0, FALSE); /* use default behaviour */
58
SSM (sci, SCI_SETMARGINWIDTHN, 0, 0 );
66
SSM(sci, SCI_SETMARGINWIDTHN, 0, 0);
62
void sci_set_mark_long_lines(ScintillaObject * sci, gint type, gint column, const gchar *colour)
71
void sci_set_mark_long_lines(ScintillaObject *sci, gint type, gint column, const gchar *colour)
119
130
/* end of lines */
120
void sci_set_visible_eols(ScintillaObject* sci, gboolean set )
122
SSM(sci,SCI_SETVIEWEOL,set,0);
125
void sci_set_visible_white_spaces(ScintillaObject* sci, gboolean set )
128
SSM(sci,SCI_SETVIEWWS,SCWS_VISIBLEALWAYS,0);
130
SSM(sci,SCI_SETVIEWWS,SCWS_INVISIBLE,0);
133
void sci_set_lines_wrapped(ScintillaObject* sci, gboolean set )
136
SSM(sci,SCI_SETWRAPMODE,SC_WRAP_WORD,0);
138
SSM(sci,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
141
gint sci_get_eol_mode( ScintillaObject* sci)
143
return SSM( sci, SCI_GETEOLMODE, 0, 0);
146
void sci_set_eol_mode( ScintillaObject* sci, gint eolmode)
148
SSM( sci, SCI_SETEOLMODE, eolmode, 0);
151
void sci_convert_eols( ScintillaObject* sci, gint eolmode)
153
SSM( sci, SCI_CONVERTEOLS, eolmode,0);
156
void sci_add_text(ScintillaObject* sci, const gchar* text)
131
void sci_set_visible_eols(ScintillaObject *sci, gboolean set)
133
SSM(sci, SCI_SETVIEWEOL, set, 0);
137
void sci_set_visible_white_spaces(ScintillaObject *sci, gboolean set)
140
SSM(sci, SCI_SETVIEWWS, SCWS_VISIBLEALWAYS, 0);
142
SSM(sci, SCI_SETVIEWWS, SCWS_INVISIBLE, 0);
146
void sci_set_lines_wrapped(ScintillaObject *sci, gboolean set)
149
SSM(sci, SCI_SETWRAPMODE, SC_WRAP_WORD, 0);
151
SSM(sci, SCI_SETWRAPMODE, SC_WRAP_NONE, 0);
155
gint sci_get_eol_mode(ScintillaObject *sci)
157
return SSM(sci, SCI_GETEOLMODE, 0, 0);
161
void sci_set_eol_mode(ScintillaObject *sci, gint eolmode)
163
SSM(sci, SCI_SETEOLMODE, eolmode, 0);
167
void sci_convert_eols(ScintillaObject *sci, gint eolmode)
169
SSM(sci, SCI_CONVERTEOLS, eolmode, 0);
173
void sci_add_text(ScintillaObject *sci, const gchar *text)
158
175
if (text != NULL)
159
{ /* if null text is passed to scintilla will segfault */
160
SSM( sci, SCI_ADDTEXT, strlen(text), (sptr_t) text);
176
{ /* if null text is passed scintilla will segfault */
177
SSM(sci, SCI_ADDTEXT, strlen(text), (sptr_t) text);
165
183
* @param sci Scintilla widget.
166
184
* @param text Text. */
167
void sci_set_text(ScintillaObject* sci, const gchar* text)
185
void sci_set_text(ScintillaObject *sci, const gchar *text)
169
187
if( text != NULL ){ /* if null text is passed to scintilla will segfault */
170
SSM( sci, SCI_SETTEXT, 0, (sptr_t) text);
188
SSM(sci, SCI_SETTEXT, 0, (sptr_t) text);
175
gboolean sci_can_undo( ScintillaObject* sci )
177
return SSM( sci, SCI_CANUNDO, 0, 0);
181
gboolean sci_can_redo( ScintillaObject* sci )
183
return SSM( sci, SCI_CANREDO, 0, 0);
187
void sci_undo( ScintillaObject* sci )
189
if( sci_can_undo(sci) )
190
SSM( sci, SCI_UNDO, 0, 0);
194
void sci_redo( ScintillaObject* sci )
196
if( sci_can_redo( sci ) )
197
SSM( sci, SCI_REDO,0,0);
201
/** Begin grouping a set of edits together as one Undo action.
193
gboolean sci_can_undo(ScintillaObject *sci)
195
return SSM(sci, SCI_CANUNDO, 0, 0);
199
gboolean sci_can_redo(ScintillaObject *sci)
201
return SSM(sci, SCI_CANREDO, 0, 0);
205
void sci_undo(ScintillaObject *sci)
207
if (sci_can_undo(sci))
208
SSM(sci, SCI_UNDO, 0, 0);
212
void sci_redo(ScintillaObject *sci)
214
if (sci_can_redo(sci))
215
SSM(sci, SCI_REDO, 0, 0);
219
/** Begins grouping a set of edits together as one Undo action.
202
220
* You must call sci_end_undo_action() after making your edits.
203
221
* @param sci Scintilla @c GtkWidget. */
204
void sci_start_undo_action( ScintillaObject* sci )
222
void sci_start_undo_action(ScintillaObject *sci)
206
SSM( sci,SCI_BEGINUNDOACTION,0,0 );
224
SSM(sci, SCI_BEGINUNDOACTION, 0, 0);
210
/** End grouping a set of edits together as one Undo action.
228
/** Ends grouping a set of edits together as one Undo action.
211
229
* @param sci Scintilla @c GtkWidget.
212
230
* @see sci_start_undo_action(). */
213
void sci_end_undo_action( ScintillaObject* sci )
215
SSM( sci, SCI_ENDUNDOACTION,0,0);
219
void sci_set_undo_collection( ScintillaObject* sci, gboolean set )
221
SSM( sci, SCI_SETUNDOCOLLECTION,set,0);
225
void sci_empty_undo_buffer( ScintillaObject* sci )
227
SSM( sci, SCI_EMPTYUNDOBUFFER,0,0);
231
void sci_end_undo_action(ScintillaObject *sci)
233
SSM(sci, SCI_ENDUNDOACTION, 0, 0);
237
void sci_set_undo_collection(ScintillaObject *sci, gboolean set)
239
SSM(sci, SCI_SETUNDOCOLLECTION, set, 0);
243
void sci_empty_undo_buffer(ScintillaObject *sci)
245
SSM(sci, SCI_EMPTYUNDOBUFFER, 0, 0);
237
void sci_zoom_in( ScintillaObject* sci )
239
SSM( sci, SCI_ZOOMIN,0,0);
243
void sci_zoom_out( ScintillaObject* sci )
245
SSM( sci, SCI_ZOOMOUT,0,0);
249
void sci_zoom_off( ScintillaObject* sci )
251
SSM( sci, SCI_SETZOOM,0,0);
255
gint sci_get_zoom( ScintillaObject* sci )
257
return SSM( sci, SCI_GETZOOM,0,0);
261
void sci_set_marker_at_line( ScintillaObject* sci, gint line_number, gboolean set, gint marker )
265
SSM( sci, SCI_MARKERADD, line_number, marker);
269
SSM( sci, SCI_MARKERDELETE, line_number, marker);
274
gboolean sci_is_marker_set_at_line(ScintillaObject* sci, gint line, gint marker)
255
void sci_zoom_in(ScintillaObject *sci)
257
SSM(sci, SCI_ZOOMIN, 0, 0);
261
void sci_zoom_out(ScintillaObject *sci)
263
SSM(sci, SCI_ZOOMOUT, 0, 0);
267
void sci_zoom_off(ScintillaObject *sci)
269
SSM(sci, SCI_SETZOOM, 0, 0);
273
gint sci_get_zoom(ScintillaObject *sci)
275
return SSM(sci, SCI_GETZOOM, 0, 0);
279
/** Sets a line marker.
280
* @param sci Scintilla widget.
281
* @param line_number Line number.
282
* @param marker Marker number. */
283
void sci_set_marker_at_line(ScintillaObject *sci, gint line_number, gint marker)
285
SSM(sci, SCI_MARKERADD, line_number, marker);
289
/** Deletes a line marker.
290
* @param sci Scintilla widget.
291
* @param line_number Line number.
292
* @param marker Marker number. */
293
void sci_delete_marker_at_line(ScintillaObject *sci, gint line_number, gint marker)
295
SSM(sci, SCI_MARKERDELETE, line_number, marker);
299
/** Checks if a line has a marker set.
300
* @param sci Scintilla widget.
301
* @param line Line number.
302
* @param marker Marker number.
303
* @return Whether it's set. */
304
gboolean sci_is_marker_set_at_line(ScintillaObject *sci, gint line, gint marker)
278
state = SSM( sci, SCI_MARKERGET, line, 0 );
308
state = SSM(sci, SCI_MARKERGET, line, 0);
279
309
return (state & (1 << marker));
283
void sci_toggle_marker_at_line(ScintillaObject* sci, gint line, gint marker)
313
void sci_toggle_marker_at_line(ScintillaObject *sci, gint line, gint marker)
285
315
gboolean set = sci_is_marker_set_at_line(sci, line, marker);
287
sci_set_marker_at_line(sci, line, set, marker);
318
sci_set_marker_at_line(sci, line, marker);
320
sci_delete_marker_at_line(sci, line, marker);
291
324
/* Returns the line number of the next marker that matches marker_mask, or -1.
292
325
* marker_mask is a bitor of 1 << marker_index. (See MarkerHandleSet::MarkValue()).
293
326
* Note: If there is a marker on the line, it returns the same line. */
294
gint sci_marker_next(ScintillaObject* sci, gint line, gint marker_mask, gboolean wrap)
327
gint sci_marker_next(ScintillaObject *sci, gint line, gint marker_mask, gboolean wrap)
296
329
gint marker_line;
324
/** Get line number from position.
357
/** Gets the line number from @a position.
325
358
* @param sci Scintilla widget.
326
359
* @param position Position. */
327
gint sci_get_line_from_position(ScintillaObject* sci, gint position )
360
gint sci_get_line_from_position(ScintillaObject *sci, gint position)
329
362
return SSM(sci, SCI_LINEFROMPOSITION, position, 0);
333
/** Get column number relative to the start of the line that @a position is on.
366
/** Gets the column number relative to the start of the line that @a position is on.
334
367
* @param sci Scintilla widget.
335
368
* @param position Position. */
336
gint sci_get_col_from_position(ScintillaObject* sci, gint position )
369
gint sci_get_col_from_position(ScintillaObject *sci, gint position)
338
371
return SSM(sci, SCI_GETCOLUMN, position, 0);
342
/** Get position for the start of @a line.
375
/** Gets the position for the start of @a line.
343
376
* @param sci Scintilla widget.
344
377
* @param line Line.
345
378
* @return Position. */
346
gint sci_get_position_from_line(ScintillaObject* sci, gint line )
379
gint sci_get_position_from_line(ScintillaObject *sci, gint line)
348
381
return SSM(sci, SCI_POSITIONFROMLINE, line, 0);
352
/** Get cursor position.
385
/** Gets the cursor position.
353
386
* @param sci Scintilla widget.
354
387
* @return Position. */
355
gint sci_get_current_position(ScintillaObject* sci )
388
gint sci_get_current_position(ScintillaObject *sci)
357
390
return SSM(sci, SCI_GETCURRENTPOS, 0, 0);
361
/** Set the cursor position.
394
/** Sets the cursor position.
362
395
* @param sci Scintilla widget.
363
396
* @param position Position.
364
397
* @param scroll_to_caret Whether to scroll the cursor in view. */
365
void sci_set_current_position(ScintillaObject* sci, gint position, gboolean scroll_to_caret)
398
void sci_set_current_position(ScintillaObject *sci, gint position, gboolean scroll_to_caret)
367
400
if (scroll_to_caret)
368
401
SSM(sci, SCI_GOTOPOS, position, 0);
378
411
/* Set the cursor line without scrolling the view.
379
412
* Use sci_goto_line() to also scroll. */
380
void sci_set_current_line(ScintillaObject* sci, gint line)
413
void sci_set_current_line(ScintillaObject *sci, gint line)
382
415
gint pos = sci_get_position_from_line(sci, line);
383
416
sci_set_current_position(sci, pos, FALSE);
387
/** Get total number of lines.
420
/** Gets the total number of lines.
388
421
* @param sci Scintilla widget. */
389
gint sci_get_line_count( ScintillaObject* sci )
422
gint sci_get_line_count(ScintillaObject *sci)
391
424
return SSM(sci, SCI_GETLINECOUNT, 0, 0);
395
/** Set selection start position.
428
/** Sets the selection start position.
396
429
* @param sci Scintilla widget.
397
430
* @param position Position. */
398
void sci_set_selection_start(ScintillaObject* sci, gint position)
431
void sci_set_selection_start(ScintillaObject *sci, gint position)
400
433
SSM(sci, SCI_SETSELECTIONSTART, position, 0);
404
/** Set selection end position.
437
/** Sets the selection end position.
405
438
* @param sci Scintilla widget.
406
439
* @param position Position. */
407
void sci_set_selection_end(ScintillaObject* sci, gint position)
440
void sci_set_selection_end(ScintillaObject *sci, gint position)
409
442
SSM(sci, SCI_SETSELECTIONEND, position, 0);
419
gint sci_get_line_end_position(ScintillaObject* sci, gint line)
452
gint sci_get_line_end_position(ScintillaObject *sci, gint line)
421
454
return SSM(sci, SCI_GETLINEENDPOSITION, line, 0);
425
void sci_cut(ScintillaObject* sci)
458
void sci_cut(ScintillaObject *sci)
427
460
SSM(sci, SCI_CUT, 0, 0);
431
void sci_copy(ScintillaObject* sci)
464
void sci_copy(ScintillaObject *sci)
433
466
SSM(sci, SCI_COPY, 0, 0);
437
void sci_paste(ScintillaObject* sci)
470
void sci_paste(ScintillaObject *sci)
439
472
SSM(sci, SCI_PASTE, 0, 0);
443
void sci_clear(ScintillaObject* sci)
476
void sci_clear(ScintillaObject *sci)
445
478
SSM(sci, SCI_CLEAR, 0, 0);
449
/** Get position of selection start.
450
* @param sci Scintilla widget.
451
* @return Position. */
452
gint sci_get_selection_start(ScintillaObject* sci)
454
return SSM(sci, SCI_GETSELECTIONSTART,0,0);
458
/** Get position of selection end.
459
* @param sci Scintilla widget.
460
* @return Position. */
461
gint sci_get_selection_end(ScintillaObject* sci)
463
return SSM(sci, SCI_GETSELECTIONEND,0,0);
467
/** Replace selection.
482
/** Gets the selection start position.
483
* @param sci Scintilla widget.
484
* @return Position. */
485
gint sci_get_selection_start(ScintillaObject *sci)
487
return SSM(sci, SCI_GETSELECTIONSTART, 0, 0);
491
/** Gets the selection end position.
492
* @param sci Scintilla widget.
493
* @return Position. */
494
gint sci_get_selection_end(ScintillaObject *sci)
496
return SSM(sci, SCI_GETSELECTIONEND, 0, 0);
500
/** Replaces selection.
468
501
* @param sci Scintilla widget.
469
502
* @param text Text. */
470
void sci_replace_sel(ScintillaObject* sci, const gchar* text)
503
void sci_replace_sel(ScintillaObject *sci, const gchar *text)
472
SSM(sci, SCI_REPLACESEL,0, (sptr_t) text);
505
SSM(sci, SCI_REPLACESEL, 0, (sptr_t) text);
476
/** Get length of all text.
509
/** Gets the length of all text.
477
510
* @param sci Scintilla widget.
478
511
* @return Length. */
479
gint sci_get_length(ScintillaObject* sci)
481
return SSM(sci,SCI_GETLENGTH,0,0);
485
gint sci_get_lexer(ScintillaObject* sci)
487
return SSM(sci,SCI_GETLEXER,0,0);
512
gint sci_get_length(ScintillaObject *sci)
514
return SSM(sci, SCI_GETLENGTH, 0, 0);
518
gint sci_get_lexer(ScintillaObject *sci)
520
return SSM(sci, SCI_GETLEXER, 0, 0);
524
/** Gets line length.
492
525
* @param sci Scintilla widget.
493
526
* @param line Line number.
494
527
* @return Length. */
495
gint sci_get_line_length(ScintillaObject* sci,gint line)
497
return SSM(sci,SCI_LINELENGTH, line,0);
501
/** Get line contents.
528
gint sci_get_line_length(ScintillaObject *sci, gint line)
530
return SSM(sci, SCI_LINELENGTH, line, 0);
534
/* safe way to read Scintilla string into new memory.
535
* works with any string buffer messages that follow the Windows message convention. */
536
gchar *sci_get_string(ScintillaObject *sci, gint msg, gulong wParam)
538
gint size = SSM(sci, msg, wParam, 0) + 1;
539
gchar *str = g_malloc(size);
541
SSM(sci, msg, wParam, (sptr_t)str);
542
str[size - 1] = '\0'; /* ensure termination, needed for SCI_GETLINE */
547
/** Gets line contents.
502
548
* @param sci Scintilla widget.
503
549
* @param line_num Line number.
504
550
* @return A @c NULL-terminated copy of the line text. */
505
gchar *sci_get_line(ScintillaObject* sci, gint line_num)
551
gchar *sci_get_line(ScintillaObject *sci, gint line_num)
507
gint len = sci_get_line_length(sci, line_num);
508
gchar *linebuf = g_malloc(len + 1);
510
SSM(sci, SCI_GETLINE, line_num, (sptr_t) linebuf);
553
return sci_get_string(sci, SCI_GETLINE, line_num);
517
558
* @deprecated sci_get_text is deprecated and should not be used in newly-written code.
518
559
* Use sci_get_contents() instead.
520
561
* @param sci Scintilla widget.
521
562
* @param len Length of @a text buffer, usually sci_get_length() + 1.
522
563
* @param text Text buffer; must be allocated @a len + 1 bytes for null-termination. */
523
void sci_get_text(ScintillaObject* sci, gint len, gchar* text)
564
void sci_get_text(ScintillaObject *sci, gint len, gchar *text)
525
SSM( sci, SCI_GETTEXT, len, (sptr_t) text );
566
SSM(sci, SCI_GETTEXT, len, (sptr_t) text);
528
/** Get all text inside a given text length.
570
/** Gets all text inside a given text length.
529
571
* @param sci Scintilla widget.
530
572
* @param len Length of the text to retrieve from the start of the document,
531
573
* usually sci_get_length() + 1.
562
606
gchar *sci_get_selection_contents(ScintillaObject *sci)
564
gint len = sci_get_selected_text_length(sci);
565
gchar *selection = g_malloc(len + 1);
567
SSM(sci, SCI_GETSELTEXT, 0, (sptr_t) selection);
608
return sci_get_string(sci, SCI_GETSELTEXT, 0);
572
/** Get selected text length.
612
/** Gets selected text length.
573
613
* @param sci Scintilla widget.
574
614
* @return Length. */
575
gint sci_get_selected_text_length(ScintillaObject* sci)
615
gint sci_get_selected_text_length(ScintillaObject *sci)
577
return SSM( sci, SCI_GETSELTEXT, 0, 0);
617
return SSM(sci, SCI_GETSELTEXT, 0, 0);
580
gint sci_get_position_from_xy(ScintillaObject* sci, gint x, gint y, gboolean nearby)
621
gint sci_get_position_from_xy(ScintillaObject *sci, gint x, gint y, gboolean nearby)
582
623
/* for nearby return -1 if there is no character near to the x,y point. */
583
624
return SSM(sci, (nearby) ? SCI_POSITIONFROMPOINTCLOSE : SCI_POSITIONFROMPOINT, x, y);
587
/** Check if a line is visible (folding may have hidden it).
628
/** Checks if a line is visible (folding may have hidden it).
588
629
* @param sci Scintilla widget.
589
630
* @param line Line number.
590
631
* @return Whether @a line will be drawn on the screen. */
591
gboolean sci_get_line_is_visible(ScintillaObject* sci, gint line)
632
gboolean sci_get_line_is_visible(ScintillaObject *sci, gint line)
593
return SSM(sci,SCI_GETLINEVISIBLE, line,0);
634
return SSM(sci, SCI_GETLINEVISIBLE, line, 0);
597
/** Make the @a line visible (folding may have hidden it).
638
/** Makes @a line visible (folding may have hidden it).
598
639
* @param sci Scintilla widget.
599
640
* @param line Line number. */
600
void sci_ensure_line_is_visible(ScintillaObject* sci, gint line)
641
void sci_ensure_line_is_visible(ScintillaObject *sci, gint line)
602
SSM(sci,SCI_ENSUREVISIBLE,line,0);
643
SSM(sci, SCI_ENSUREVISIBLE, line, 0);
606
gint sci_get_fold_level(ScintillaObject* sci, gint line)
647
gint sci_get_fold_level(ScintillaObject *sci, gint line)
608
return SSM(sci,SCI_GETFOLDLEVEL, line,0);
649
return SSM(sci, SCI_GETFOLDLEVEL, line, 0);
612
653
/* Get the line number of the fold point before start_line, or -1 if there isn't one */
613
gint sci_get_fold_parent(ScintillaObject* sci, gint start_line)
615
return SSM( sci, SCI_GETFOLDPARENT, start_line, 0);
619
void sci_toggle_fold(ScintillaObject* sci, gint line)
621
SSM( sci, SCI_TOGGLEFOLD, line, 1);
625
gboolean sci_get_fold_expanded(ScintillaObject* sci, gint line)
627
return SSM( sci, SCI_GETFOLDEXPANDED, line, 0);
631
void sci_colourise( ScintillaObject* sci, gint start, gint end)
633
SSM( sci, SCI_COLOURISE, start, end);
637
void sci_clear_all(ScintillaObject * sci)
639
SSM( sci, SCI_CLEARALL, 0, 0);
643
gint sci_get_end_styled(ScintillaObject * sci)
645
return SSM(sci,SCI_GETENDSTYLED, 0,0);
649
void sci_set_tab_width(ScintillaObject * sci, gint width)
654
gint sci_get_fold_parent(ScintillaObject *sci, gint start_line)
656
return SSM(sci, SCI_GETFOLDPARENT, start_line, 0);
660
void sci_toggle_fold(ScintillaObject *sci, gint line)
662
SSM(sci, SCI_TOGGLEFOLD, line, 1);
666
gboolean sci_get_fold_expanded(ScintillaObject *sci, gint line)
668
return SSM(sci, SCI_GETFOLDEXPANDED, line, 0);
672
void sci_colourise(ScintillaObject *sci, gint start, gint end)
674
SSM(sci, SCI_COLOURISE, start, end);
678
void sci_clear_all(ScintillaObject *sci)
680
SSM(sci, SCI_CLEARALL, 0, 0);
684
gint sci_get_end_styled(ScintillaObject *sci)
686
return SSM(sci, SCI_GETENDSTYLED, 0, 0);
690
void sci_set_tab_width(ScintillaObject *sci, gint width)
651
692
SSM(sci, SCI_SETTABWIDTH, width, 0);
655
/** Get display tab width (this is not indent width, see GeanyIndentPrefs).
696
/** Gets display tab width (this is not indent width, see GeanyIndentPrefs).
656
697
* @param sci Scintilla widget.
661
gint sci_get_tab_width(ScintillaObject * sci)
702
gint sci_get_tab_width(ScintillaObject *sci)
663
704
return SSM(sci, SCI_GETTABWIDTH, 0, 0);
708
/** Gets a character.
668
709
* @param sci Scintilla widget.
669
710
* @param pos Position.
670
711
* @return Char. */
752
794
gint sci_search_next(ScintillaObject *sci, gint flags, const gchar *text)
754
return SSM(sci, SCI_SEARCHNEXT, flags, (sptr_t) text );
796
return SSM(sci, SCI_SEARCHNEXT, flags, (sptr_t) text);
758
800
gint sci_search_prev(ScintillaObject *sci, gint flags, const gchar *text)
760
return SSM(sci, SCI_SEARCHPREV, flags, (sptr_t) text );
802
return SSM(sci, SCI_SEARCHPREV, flags, (sptr_t) text);
806
/** Finds text in the document.
807
* The @a ttf argument should be a pointer to a Sci_TextToFind structure which contains
808
* the text to find and the range in which the text should be searched.
810
* Please refer to the Scintilla documentation for a more detailed description.
812
* @param sci Scintilla widget.
813
* @param flags Bitmask of Scintilla search flags (@c SCFIND_*, see Scintilla documentation).
814
* @param ttf Pointer to a TextToFind structure which contains the text to find and the range.
815
* @return The position of the start of the found text if it succeeds, otherwise @c -1.
816
* The @c chrgText.cpMin and @c chrgText.cpMax members of @c TextToFind are filled in
817
* with the start and end positions of the found text.
764
819
gint sci_find_text(ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf)
766
return SSM(sci, SCI_FINDTEXT, flags, (long) ttf );
821
return SSM(sci, SCI_FINDTEXT, flags, (long) ttf);
770
void sci_set_font(ScintillaObject *sci, gint style, const gchar* font, gint size)
825
void sci_set_font(ScintillaObject *sci, gint style, const gchar *font, gint size)
772
827
SSM(sci, SCI_STYLESETFONT, style, (sptr_t) font);
773
828
SSM(sci, SCI_STYLESETSIZE, style, size);
832
/** Jumps to the specified line in the document.
833
* If @a unfold is set and @a line is hidden by a fold, it is unfolded
834
* first to ensure it is visible.
835
* @param sci Scintilla widget.
837
* @param unfold Whether to unfold first.
777
839
void sci_goto_line(ScintillaObject *sci, gint line, gboolean unfold)
779
841
if (unfold) SSM(sci, SCI_ENSUREVISIBLE, line, 0);
1011
1085
return SSM(sci, SCI_BRACEMATCH, pos, 0);
1014
1089
gint sci_get_overtype(ScintillaObject *sci)
1016
1091
return SSM(sci, SCI_GETOVERTYPE, 0, 0);
1019
1095
void sci_set_tab_indents(ScintillaObject *sci, gboolean set)
1021
1097
SSM(sci, SCI_SETTABINDENTS, set, 0);
1024
1101
void sci_set_use_tabs(ScintillaObject *sci, gboolean set)
1026
1103
SSM(sci, SCI_SETUSETABS, set, 0);
1029
1107
gint sci_get_pos_at_line_sel_start(ScintillaObject *sci, gint line)
1031
1109
return SSM(sci, SCI_GETLINESELSTARTPOSITION, line, 0);
1034
1113
gint sci_get_pos_at_line_sel_end(ScintillaObject *sci, gint line)
1036
1115
return SSM(sci, SCI_GETLINESELENDPOSITION, line, 0);
1039
/** Get selection mode.
1119
/** Gets selection mode.
1040
1120
* @param sci Scintilla widget.
1041
1121
* @return Selection mode. */
1042
1122
gint sci_get_selection_mode(ScintillaObject *sci)
1052
1133
SSM(sci, SCI_SETSELECTIONMODE, mode, 0);
1055
1137
void sci_set_scrollbar_mode(ScintillaObject *sci, gboolean visible)
1057
1139
SSM(sci, SCI_SETHSCROLLBAR, visible, 0);
1058
1140
SSM(sci, SCI_SETVSCROLLBAR, visible, 0);
1144
/** Sets the indentation of a line.
1145
* @param sci Scintilla widget.
1146
* @param line Line to indent.
1147
* @param indent Indentation width.
1061
1151
void sci_set_line_indentation(ScintillaObject *sci, gint line, gint indent)
1063
1153
SSM(sci, SCI_SETLINEINDENTATION, line, indent);
1066
int sci_get_line_indentation(ScintillaObject *sci, gint line)
1157
/** Gets the indentation width of a line.
1158
* @param sci Scintilla widget.
1159
* @param line Line to get the indentation from.
1160
* @return Indentation width.
1164
gint sci_get_line_indentation(ScintillaObject *sci, gint line)
1068
1166
return SSM(sci, SCI_GETLINEINDENTATION, line, 0);
1071
1170
void sci_set_caret_policy_x(ScintillaObject *sci, gint policy, gint slop)
1073
1172
SSM(sci, SCI_SETXCARETPOLICY, policy, slop);
1076
1176
void sci_set_caret_policy_y(ScintillaObject *sci, gint policy, gint slop)
1078
1178
SSM(sci, SCI_SETYCARETPOLICY, policy, slop);
1081
void sci_set_scroll_stop_at_last_line(ScintillaObject* sci, gboolean set)
1182
void sci_set_scroll_stop_at_last_line(ScintillaObject *sci, gboolean set)
1083
1184
SSM(sci, SCI_SETENDATLASTLINE, set, 0);
1086
1188
void sci_cancel(ScintillaObject *sci)
1088
SSM( sci, SCI_CANCEL, 0, 0);
1190
SSM(sci, SCI_CANCEL, 0, 0);
1091
1194
gint sci_get_target_end(ScintillaObject *sci)
1093
return SSM( sci, SCI_GETTARGETEND, 0, 0);
1196
return SSM(sci, SCI_GETTARGETEND, 0, 0);
1096
1200
gint sci_get_position_after(ScintillaObject *sci, gint start)
1098
1202
return SSM(sci, SCI_POSITIONAFTER, start, 0);
1101
1206
void sci_lines_split(ScintillaObject *sci, gint pixelWidth)
1103
1208
SSM(sci, SCI_LINESSPLIT, pixelWidth, 0);
1106
1212
void sci_lines_join(ScintillaObject *sci)
1108
1214
SSM(sci, SCI_LINESJOIN, 0, 0);
1111
1218
gint sci_text_width(ScintillaObject *sci, gint styleNumber, const gchar *text)
1113
1220
return SSM(sci, SCI_TEXTWIDTH, styleNumber, (sptr_t) text);