1 /***************************************************************************
3 TextEditor.mcc - Textediting MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005-2014 TextEditor.mcc Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 TextEditor class Support Site: http://www.sf.net/projects/texteditor-mcc
21 ***************************************************************************/
23 #include <intuition/classes.h>
24 #include <utility/tagitem.h>
25 #include <clib/alib_protos.h>
27 #include <proto/exec.h>
28 #include <proto/graphics.h>
29 #include <proto/utility.h>
30 #include <proto/layers.h>
31 #include <proto/intuition.h>
33 #include <libraries/mui.h>
34 #include <proto/muimaster.h>
42 IPTR
mGet(struct IClass
*cl
, Object
*obj
, struct opGet
*msg
)
44 struct InstData
*data
= INST_DATA(cl
, obj
);
49 switch(msg
->opg_AttrID
)
51 case MUIA_TextEditor_CursorPosition
:
56 LONG x
= data
->CPos_X
;
57 struct line_node
*line
= data
->actualline
;
58 LONG line_nr
= LineToVisual(data
, line
) - 1;
61 OffsetToLines(data
, x
, line
, &pos
);
63 // calculate the cursor width
64 // if it is set to 6 then we should find out how the width of the current char is
65 if(data
->CursorWidth
== 6)
66 cursor_width
= TextLength(&data
->tmprp
, line
->line
.Contents
[x
] < ' ' ? (char *)" " : (char *)&line
->line
.Contents
[x
], 1);
68 cursor_width
= data
->CursorWidth
;
70 xplace
= _mleft(obj
) + TextLength(&data
->tmprp
, &line
->line
.Contents
[x
-pos
.x
], pos
.x
);
71 xplace
+= FlowSpace(data
, line
->line
.Flow
, &line
->line
.Contents
[pos
.bytes
]);
72 yplace
= data
->ypos
+ (data
->fontheight
* (line_nr
+ pos
.lines
- 1));
74 data
->CursorPosition
.MinX
= xplace
;
75 data
->CursorPosition
.MinY
= yplace
;
76 data
->CursorPosition
.MaxX
= xplace
+ cursor_width
- 1;
77 data
->CursorPosition
.MaxY
= yplace
+ data
->fontheight
- 1;
78 ti_Data
= (IPTR
)&data
->CursorPosition
;
82 case MUIA_TextEditor_UndoAvailable
:
83 ti_Data
= (data
->nextUndoStep
> 0) ? TRUE
: FALSE
;
86 case MUIA_TextEditor_RedoAvailable
:
87 ti_Data
= (data
->nextUndoStep
< data
->usedUndoSteps
) ? TRUE
: FALSE
;
90 case MUIA_TextEditor_ActiveObjectOnClick
:
91 ti_Data
= isFlagSet(data
->flags
, FLG_ActiveOnClick
);
94 case MUIA_TextEditor_AutoClip
:
95 ti_Data
= isFlagSet(data
->flags
, FLG_AutoClip
);
98 case MUIA_TextEditor_KeyUpFocus
:
99 ti_Data
= (IPTR
)data
->KeyUpFocus
;
103 ti_Data
= LIB_VERSION
;
107 ti_Data
= LIB_REVISION
;
110 case MUIA_ControlChar
:
111 ti_Data
= (IPTR
)data
->CtrlChar
;
114 case MUIA_TextEditor_AreaMarked
:
115 ti_Data
= Enabled(data
);
117 case MUIA_TextEditor_CursorX
:
118 ti_Data
= data
->CPos_X
;
120 case MUIA_TextEditor_CursorY
:
121 ti_Data
= LineNr(data
, data
->actualline
)-1;
123 case MUIA_TextEditor_ExportWrap
:
124 ti_Data
= data
->ExportWrap
;
126 case MUIA_TextEditor_FixedFont
:
127 ti_Data
= data
->use_fixedfont
;
129 case MUIA_TextEditor_Pen
:
132 case MUIA_TextEditor_Flow
:
133 ti_Data
= data
->Flow
;
135 case MUIA_TextEditor_Separator
:
136 ti_Data
= data
->Separator
;
138 case MUIA_TextEditor_HasChanged
:
139 ti_Data
= data
->HasChanged
;
141 case MUIA_TextEditor_HorizontalScroll
:
142 ti_Data
= isFlagSet(data
->flags
, FLG_HScroll
);
144 case MUIA_TextEditor_ImportWrap
:
145 ti_Data
= data
->ImportWrap
;
147 /* case MUIA_TextEditor_InsertMode:
148 ti_Data = data->InsertMode;
151 case MUIA_TextEditor_Prop_Entries
:
152 ti_Data
= data
->totallines
;
154 case MUIA_TextEditor_Prop_Visible
:
155 ti_Data
= data
->maxlines
;
157 case MUIA_TextEditor_Prop_DeltaFactor
:
158 ti_Data
= data
->fontheight
;
160 case MUIA_TextEditor_Prop_First
:
161 ti_Data
= (data
->visual_y
-1)*data
->fontheight
;
163 case MUIA_TextEditor_ReadOnly
:
164 ti_Data
= isFlagSet(data
->flags
, FLG_ReadOnly
);
166 case MUIA_TextEditor_Quiet
:
167 ti_Data
= isFlagSet(data
->flags
, FLG_Quiet
);
169 case MUIA_TextEditor_StyleBold
:
170 ti_Data
= ((GetStyle(data
->CPos_X
, data
->actualline
) & BOLD
) ? TRUE
: FALSE
);
172 case MUIA_TextEditor_StyleItalic
:
173 ti_Data
= ((GetStyle(data
->CPos_X
, data
->actualline
) & ITALIC
) ? TRUE
: FALSE
);
175 case MUIA_TextEditor_StyleUnderline
:
176 ti_Data
= ((GetStyle(data
->CPos_X
, data
->actualline
) & UNDERLINE
) ? TRUE
: FALSE
);
178 case MUIA_TextEditor_TypeAndSpell
:
179 ti_Data
= data
->TypeAndSpell
;
182 case MUIA_TextEditor_WrapBorder
:
183 ti_Data
= data
->WrapBorder
;
186 case MUIA_TextEditor_WrapMode
:
187 ti_Data
= data
->WrapMode
;
190 case MUIA_TextEditor_WrapWords
:
191 ti_Data
= data
->WrapWords
;
195 ti_Data
= (IPTR
)data
->font
;
198 case MUIA_TextEditor_UndoLevels
:
199 ti_Data
= data
->maxUndoSteps
;
202 case MUIA_TextEditor_PasteStyles
:
203 ti_Data
= isFlagSet(data
->flags
, FLG_PasteStyles
);
206 case MUIA_TextEditor_PasteColors
:
207 ti_Data
= isFlagSet(data
->flags
, FLG_PasteColors
);
210 case MUIA_TextEditor_ConvertTabs
:
211 ti_Data
= data
->ConvertTabs
;
214 case MUIA_TextEditor_TabSize
:
215 ti_Data
= data
->TabSize
;
218 case MUIA_TextEditor_MatchedKeyword
:
219 // just a dummy to make notifications work
220 ti_Data
= (IPTR
)NULL
;
225 return(DoSuperMethodA(cl
, obj
, (Msg
)msg
));
228 *msg
->opg_Storage
= ti_Data
;
236 IPTR
mSet(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
238 struct InstData
*data
= INST_DATA(cl
, obj
);
239 struct TagItem
*tags
, *tag
;
240 const char *contents
= NULL
;
242 LONG crsr_x
= INT_MAX
;
243 LONG crsr_y
= INT_MAX
;
244 BOOL reimport
= FALSE
;
248 if(data
->shown
== TRUE
&& isFlagClear(data
->flags
, FLG_Draw
))
250 // handle the disabled flag only if we are not under control of MUI4
251 if(isFlagClear(data
->flags
, FLG_MUI4
) && (tag
= FindTagItem(MUIA_Disabled
, msg
->ops_AttrList
)) != NULL
)
254 setFlag(data
->flags
, FLG_Ghosted
);
256 clearFlag(data
->flags
, FLG_Ghosted
);
258 data
->UpdateInfo
= msg
;
259 MUI_Redraw(obj
, MADF_DRAWUPDATE
);
261 RETURN((IPTR
)data
->UpdateInfo
);
262 return((IPTR
)data
->UpdateInfo
);
265 tags
= msg
->ops_AttrList
;
266 while((tag
= NextTagItem((APTR
)&tags
)))
268 IPTR ti_Data
= tag
->ti_Data
;
272 case MUIA_ControlChar
:
273 data
->CtrlChar
= (UBYTE
)ti_Data
;
278 BOOL modified
= FALSE
;
280 if(ti_Data
&& isFlagClear(data
->flags
, FLG_Ghosted
))
282 setFlag(data
->flags
, FLG_Ghosted
);
285 else if(!ti_Data
&& isFlagSet(data
->flags
, FLG_Ghosted
))
287 clearFlag(data
->flags
, FLG_Ghosted
);
291 // perform a redraw only if the disabled state has really changed
292 // and we are NOT under the control of MUI4 which does the ghost
294 if(modified
== TRUE
&& isFlagClear(data
->flags
, FLG_MUI4
))
296 MUI_Redraw(obj
, MADF_DRAWOBJECT
);
299 // make sure a possibly existing slider is disabled as well
300 if(data
->slider
!= NULL
)
301 set(data
->slider
, MUIA_Disabled
, ti_Data
);
305 case MUIA_TextEditor_Rows
:
306 data
->Rows
= ti_Data
;
309 case MUIA_TextEditor_Columns
:
310 data
->Columns
= ti_Data
;
313 case MUIA_TextEditor_AutoClip
:
315 setFlag(data
->flags
, FLG_AutoClip
);
317 clearFlag(data
->flags
, FLG_AutoClip
);
320 case MUIA_TextEditor_ColorMap
:
321 data
->colormap
= (ULONG
*)ti_Data
;
324 case MUIA_TextEditor_InVirtualGroup
:
326 setFlag(data
->flags
, FLG_InVGrp
);
328 clearFlag(data
->flags
, FLG_InVGrp
);
331 case MUIA_TextEditor_CursorX
:
332 if(data
->NoNotify
== FALSE
)
336 case MUIA_TextEditor_CursorY
:
337 if(data
->NoNotify
== FALSE
)
341 case MUIA_TextEditor_Prop_Release
:
342 data
->smooth_wait
= ti_Data
;
345 case MUIA_TextEditor_Prop_First
:
347 if(((data
->visual_y
-1)*data
->fontheight
+(_mtop(obj
) - data
->ypos
) != (LONG
)ti_Data
) && data
->shown
== TRUE
)
350 LONG lastpixel
= ((data
->visual_y
-1)*data
->fontheight
) + (_mtop(obj
) - data
->ypos
);
351 struct Hook
*oldhook
;
354 data
->visual_y
= (ti_Data
/data
->fontheight
)+1;
355 smooth
= ti_Data
- lastpixel
;
358 data
->scr_direction
= 1;
360 data
->scr_direction
= 0;
362 oldhook
= InstallLayerHook(data
->rport
->Layer
, LAYERS_NOBACKFILL
);
363 cliphandle
= MUI_AddClipping(muiRenderInfo(obj
), _mleft(obj
), _mtop(obj
), _mwidth(obj
), data
->maxlines
*data
->fontheight
);
364 if(smooth
> 0 && smooth
< data
->maxlines
*data
->fontheight
)
368 ScrollRasterBF(data
->rport
, 0, smooth
,
369 _mleft(obj
), _mtop(obj
),
370 _mright(obj
), _mtop(obj
) + (data
->maxlines
* data
->fontheight
) - 1);
372 data
->ypos
= _mtop(obj
) - ti_Data
%data
->fontheight
;
373 line_nr
= data
->maxlines
-(smooth
/data
->fontheight
)-1;
376 struct Layer
*layer
= data
->rport
->Layer
;
378 if(layer
->DamageList
&& layer
->DamageList
->RegionRectangle
)
380 if(MUI_BeginRefresh(muiRenderInfo(obj
),0))
382 MUI_Redraw(obj
, MADF_DRAWOBJECT
);
383 MUI_EndRefresh(muiRenderInfo(obj
), 0);
388 DumpText(data
, data
->visual_y
+line_nr
, line_nr
, data
->maxlines
+1, FALSE
);
392 if(smooth
< 0 && -smooth
< data
->maxlines
*data
->fontheight
)
396 ScrollRasterBF(data
->rport
, 0, smooth
,
397 _mleft(obj
), _mtop(obj
),
398 _mright(obj
), _mtop(obj
) + (data
->maxlines
* data
->fontheight
) - 1);
399 data
->ypos
= _mtop(obj
) - ti_Data
%data
->fontheight
;
400 lines
= (-smooth
/data
->fontheight
)+2;
402 struct Layer
*layer
= data
->rport
->Layer
;
404 if(layer
->DamageList
&& layer
->DamageList
->RegionRectangle
)
405 if(MUI_BeginRefresh(muiRenderInfo(obj
),0))
407 MUI_Redraw(obj
, MADF_DRAWOBJECT
);
408 MUI_EndRefresh(muiRenderInfo(obj
), 0);
412 DumpText(data
, data
->visual_y
, 0, lines
, FALSE
);
417 DumpText(data
, data
->visual_y
, 0, data
->maxlines
+1, FALSE
);
420 MUI_RemoveClipping(muiRenderInfo(obj
), cliphandle
);
421 InstallLayerHook(data
->rport
->Layer
, oldhook
);
423 if(data
->scrollaction
== FALSE
)
426 data
->smooth_wait
= 1;
427 data
->scrollaction
= TRUE
;
430 SetAttrs(obj
, MUIA_TextEditor_Prop_Entries
,
431 ((data
->totallines
-(data
->visual_y
-1) < data
->maxlines
) ?
432 ((data
->visual_y
-1)+data
->maxlines
) :
433 ((data
->maxlines
> data
->totallines
) ?
441 case MUIA_TextEditor_ReadOnly
:
445 SetCursor(data
, data
->CPos_X
, data
->actualline
, FALSE
);
446 setFlag(data
->flags
, FLG_ReadOnly
);
448 // force the activeOnClick to be turned off
449 // in case the user explicitly sets the readonly object
450 clearFlag(data
->flags
, FLG_ActiveOnClick
);
452 // enable that the object will automatically get a border when
453 // the ActiveObjectOnClick option is active
454 _flags(obj
) &= ~(1<<7);
458 clearFlag(data
->flags
, FLG_ReadOnly
);
459 if(data
->shown
== TRUE
)
461 if(isFlagSet(data
->flags
, FLG_Active
))
462 SetCursor(data
, data
->CPos_X
, data
->actualline
, TRUE
);
465 // disable that the object will automatically get a border when
466 // the ActiveObjectOnClick option is active
467 if(isFlagSet(data
->flags
, FLG_ActiveOnClick
))
468 _flags(obj
) |= (1<<7);
473 case MUIA_TextEditor_ActiveObjectOnClick
:
477 setFlag(data
->flags
, FLG_ActiveOnClick
);
479 // disable that the object will automatically get a border when
480 // the ActiveObjectOnClick option is active
481 _flags(obj
) |= (1<<7);
485 clearFlag(data
->flags
, FLG_ActiveOnClick
);
487 // enable that the object will automatically get a border when
488 // the ActiveObjectOnClick option is active
489 _flags(obj
) &= ~(1<<7);
494 case MUIA_TextEditor_PopWindow_Open
:
497 setFlag(data
->flags
, FLG_PopWindow
);
499 clearFlag(data
->flags
, FLG_PopWindow
);
503 case MUIA_TextEditor_Quiet
:
507 setFlag(data
->flags
, FLG_Quiet
);
511 clearFlag(data
->flags
, FLG_Quiet
);
512 MUI_Redraw(obj
, MADF_DRAWOBJECT
);
513 if(data
->maxlines
> data
->totallines
)
514 set(obj
, MUIA_TextEditor_Prop_Entries
, data
->maxlines
*data
->fontheight
);
516 set(obj
, MUIA_TextEditor_Prop_Entries
, data
->totallines
*data
->fontheight
);
517 set(obj
, MUIA_TextEditor_Prop_First
, (data
->visual_y
-1)*data
->fontheight
);
522 case MUIA_TextEditor_StyleBold
:
523 AddStyle(data
, &data
->blockinfo
, BOLD
, ti_Data
!= 0);
526 case MUIA_TextEditor_StyleItalic
:
527 AddStyle(data
, &data
->blockinfo
, ITALIC
, ti_Data
!= 0);
530 case MUIA_TextEditor_StyleUnderline
:
531 AddStyle(data
, &data
->blockinfo
, UNDERLINE
, ti_Data
!= 0);
534 case MUIA_TextEditor_Pen
:
536 if(data
->NoNotify
== FALSE
)
539 AddColor(data
, &data
->blockinfo
, (UWORD
)ti_Data
);
540 data
->HasChanged
= TRUE
;
545 case MUIA_TextEditor_KeyUpFocus
:
546 data
->KeyUpFocus
= (Object
*)ti_Data
;
549 case MUIA_TextEditor_Slider
:
551 if(data
->shown
== FALSE
)
553 data
->slider
= (void *)ti_Data
;
555 // disable the slider right away if the texteditor
556 // gadget is disabled as well.
557 if(isFlagSet(data
->flags
, FLG_Ghosted
))
558 set(data
->slider
, MUIA_Disabled
, TRUE
);
560 DoMethod(data
->slider
, MUIM_Notify
,
561 MUIA_Prop_Release
, MUIV_EveryTime
,
562 obj
, 3, MUIM_NoNotifySet
, MUIA_TextEditor_Prop_Release
, MUIV_TriggerValue
);
563 DoMethod(data
->slider
, MUIM_Notify
,
564 MUIA_Prop_First
, MUIV_EveryTime
,
565 obj
, 3, MUIM_NoNotifySet
, MUIA_TextEditor_Prop_First
, MUIV_TriggerValue
);
566 DoMethod(obj
, MUIM_Notify
,
567 MUIA_TextEditor_Prop_First
, MUIV_EveryTime
,
568 data
->slider
, 3, MUIM_NoNotifySet
, MUIA_Prop_First
, MUIV_TriggerValue
);
569 DoMethod(obj
, MUIM_Notify
,
570 MUIA_TextEditor_Prop_Entries
, MUIV_EveryTime
,
571 data
->slider
, 3, MUIM_NoNotifySet
, MUIA_Prop_Entries
, MUIV_TriggerValue
);
572 DoMethod(obj
, MUIM_Notify
,
573 MUIA_TextEditor_Prop_Visible
, MUIV_EveryTime
,
574 data
->slider
, 3, MUIM_NoNotifySet
, MUIA_Prop_Visible
, MUIV_TriggerValue
);
575 DoMethod(obj
, MUIM_Notify
,
576 MUIA_TextEditor_Prop_DeltaFactor
, MUIV_EveryTime
,
577 data
->slider
, 3, MUIM_NoNotifySet
, MUIA_Prop_DeltaFactor
, MUIV_TriggerValue
);
582 case MUIA_TextEditor_FixedFont
:
584 if(data
->shown
== FALSE
)
588 data
->font
= data
->fixedfont
;
589 data
->use_fixedfont
= TRUE
;
593 data
->font
= data
->normalfont
;
594 data
->use_fixedfont
= FALSE
;
597 // now we check whether we have a valid font or not
598 // and if not we take the default one of our muiAreaData
599 if(data
->font
== NULL
)
600 data
->font
= _font(obj
);
605 case MUIA_TextEditor_DoubleClickHook
:
606 data
->DoubleClickHook
= (struct Hook
*)ti_Data
;
609 case MUIA_TextEditor_HasChanged
:
611 data
->HasChanged
= ti_Data
;
613 clearFlag(data
->flags
, FLG_UndoLost
);
617 case MUIA_TextEditor_HorizontalScroll
:
620 setFlag(data
->flags
, FLG_HScroll
);
622 clearFlag(data
->flags
, FLG_HScroll
);
626 case MUIA_TextEditor_Contents
:
627 contents
= ti_Data
? (const char *)ti_Data
: "";
630 case MUIA_TextEditor_ImportHook
:
634 case MUIV_TextEditor_ImportHook_Plain
:
635 data
->ImportHook
= &ImPlainHook
;
637 case MUIV_TextEditor_ImportHook_EMail
:
638 data
->ImportHook
= &ImEMailHook
;
640 case MUIV_TextEditor_ImportHook_MIME
:
641 data
->ImportHook
= &ImMIMEHook
;
643 case MUIV_TextEditor_ImportHook_MIMEQuoted
:
644 data
->ImportHook
= &ImMIMEQuoteHook
;
647 data
->ImportHook
= (struct Hook
*)ti_Data
;
652 case MUIA_TextEditor_ImportWrap
:
653 data
->ImportWrap
= ti_Data
;
656 case MUIA_TextEditor_ExportHook
:
660 case MUIV_TextEditor_ExportHook_Plain
:
661 data
->ExportHook
= &ExportHookPlain
;
664 case MUIV_TextEditor_ExportHook_EMail
:
665 data
->ExportHook
= &ExportHookEMail
;
668 case MUIV_TextEditor_ExportHook_NoStyle
:
669 data
->ExportHook
= &ExportHookNoStyle
;
673 data
->ExportHook
= (struct Hook
*)ti_Data
;
678 case MUIA_TextEditor_ExportWrap
:
679 data
->ExportWrap
= ti_Data
;
682 case MUIA_TextEditor_Flow
:
684 if(data
->NoNotify
== FALSE
)
686 LONG start
, lines
= 0;
688 data
->Flow
= ti_Data
;
691 struct marking newblock
;
692 struct line_node
*startline
;
694 NiceBlock(&data
->blockinfo
, &newblock
);
695 startline
= newblock
.startline
;
696 start
= LineToVisual(data
, startline
);
700 lines
+= startline
->visual
;
701 startline
->line
.Flow
= ti_Data
;
702 startline
= GetNextLine(startline
);
704 while(startline
!= GetNextLine(newblock
.stopline
));
708 start
= LineToVisual(data
, data
->actualline
);
709 lines
= data
->actualline
->visual
;
710 data
->actualline
->line
.Flow
= ti_Data
;
715 if(start
-1+lines
> data
->maxlines
)
716 lines
= data
->maxlines
-(start
-1);
717 DumpText(data
, data
->visual_y
+start
-1, start
-1, start
-1+lines
, TRUE
);
718 data
->HasChanged
= TRUE
;
723 case MUIA_TextEditor_WrapBorder
:
725 if(data
->WrapBorder
!= (LONG
)ti_Data
)
727 data
->WrapBorder
= ti_Data
;
733 case MUIA_TextEditor_WrapMode
:
735 if(data
->WrapMode
!= ti_Data
)
737 data
->WrapMode
= ti_Data
;
743 case MUIA_TextEditor_TypeAndSpell
:
744 data
->TypeAndSpell
= ti_Data
;
747 case MUIA_TextEditor_UndoLevels
:
748 data
->userUndoBufferSize
= TRUE
;
749 ResizeUndoBuffer(data
, ti_Data
);
752 case MUIA_TextEditor_PasteStyles
:
755 setFlag(data
->flags
, FLG_PasteStyles
);
757 clearFlag(data
->flags
, FLG_PasteStyles
);
761 case MUIA_TextEditor_PasteColors
:
764 setFlag(data
->flags
, FLG_PasteColors
);
766 clearFlag(data
->flags
, FLG_PasteColors
);
770 case MUIA_TextEditor_ConvertTabs
:
772 if(data
->ConvertTabs
!= (BOOL
)ti_Data
)
774 data
->ConvertTabs
= ti_Data
;
780 case MUIA_TextEditor_TabSize
:
782 if(data
->TabSize
!= (LONG
)ti_Data
)
784 if(data
->TabSize
== MUIV_TextEditor_TabSize_Default
)
786 // reset the TAB size to the configured value
787 if(data
->TabSize
!= data
->GlobalTabSize
)
789 // reimport the text only if the TAB size really changes
790 data
->TabSize
= data
->GlobalTabSize
;
793 clearFlag(data
->flags
, FLG_ForcedTabSize
);
797 data
->TabSize
= MINMAX(2, ti_Data
, 12);
798 setFlag(data
->flags
, FLG_ForcedTabSize
);
799 // a reimport is definitely necessary
806 case MUIA_TextEditor_WrapWords
:
808 if(data
->WrapWords
!= (BOOL
)ti_Data
)
810 data
->WrapWords
= ti_Data
;
816 case MUIA_TextEditor_Keywords
:
818 ParseKeywords(data
, (const char *)tag
->ti_Data
);
826 // reimport the text to match the current TAB size and TAB conversion mode
827 result
= ReimportText(cl
, obj
);
832 struct MinList newlines
;
834 if(ImportText(data
, contents
, data
->ImportHook
, data
->ImportWrap
, &newlines
) == TRUE
)
836 FreeTextMem(data
, &data
->linelist
);
837 MoveLines(&data
->linelist
, &newlines
);
839 ResetUndoBuffer(data
);
844 if(crsr_x
!= INT_MAX
|| crsr_y
!= INT_MAX
)
846 SetCursor(data
, data
->CPos_X
, data
->actualline
, FALSE
);
848 if(crsr_y
!= INT_MAX
)
850 data
->actualline
= LineNode(data
, crsr_y
+1);
851 if(data
->actualline
->line
.Length
< data
->CPos_X
)
852 data
->CPos_X
= data
->actualline
->line
.Length
-1;
854 if(crsr_x
!= INT_MAX
)
856 data
->CPos_X
= (data
->actualline
->line
.Length
> crsr_x
) ? crsr_x
: data
->actualline
->line
.Length
-1;
859 ScrollIntoDisplay(data
);
860 SetCursor(data
, data
->CPos_X
, data
->actualline
, TRUE
);