ScintillaGateway.cs 223 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217
  1. // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
  2. using System;
  3. using System.Runtime.InteropServices;
  4. using System.Text;
  5. using static NppChnConvPlugin.NppPluginInfrastructure.Win32;
  6. namespace NppChnConvPlugin.NppPluginInfrastructure
  7. {
  8. /// <summary>
  9. /// This it the plugin-writers primary interface to Notepad++/Scintilla.
  10. /// It takes away all the complexity with command numbers and Int-pointer casting.
  11. ///
  12. /// See http://www.scintilla.org/ScintillaDoc.html for further details.
  13. /// </summary>
  14. public class ScintillaGateway : IScintillaGateway
  15. {
  16. private const int Unused = 0;
  17. private IntPtr scintilla;
  18. public static readonly int LengthZeroTerminator = "\0".Length;
  19. /// <summary>
  20. ///
  21. /// </summary>
  22. public IntPtr CurrentBufferID { get; set; }
  23. public ScintillaGateway(IntPtr scintilla)
  24. {
  25. this.scintilla = scintilla;
  26. }
  27. /// <summary>
  28. /// Switch the handle between main and second window handle.
  29. /// </summary>
  30. public void SwitchScintillaHandle()
  31. {
  32. this.scintilla = this.scintilla == PluginBase.nppData._scintillaMainHandle ? PluginBase.nppData._scintillaSecondHandle : PluginBase.nppData._scintillaMainHandle;
  33. }
  34. /// <summary>
  35. /// Change the Scintilla window handle for this Gateway
  36. /// and return the previous handle for potentially final updates.
  37. /// </summary>
  38. /// <param name="newHandle"></param>
  39. /// <returns></returns>
  40. public IntPtr SetScintillaHandle(IntPtr newHandle)
  41. {
  42. IntPtr oldHandle = this.scintilla;
  43. this.scintilla = newHandle;
  44. return oldHandle;
  45. }
  46. /// <summary>
  47. /// Return the current Scintilla window handle
  48. /// </summary>
  49. /// <returns></returns>
  50. public IntPtr GetScintillaHandle()
  51. {
  52. return this.scintilla;
  53. }
  54. public int GetSelectionLength()
  55. {
  56. var selectionLength = (int) Win32.SendMessage(scintilla, SciMsg.SCI_GETSELTEXT, Unused, Unused) - LengthZeroTerminator;
  57. return selectionLength;
  58. }
  59. public void AppendTextAndMoveCursor(string text)
  60. {
  61. AppendText(text.Length, text);
  62. GotoPos(new Position(GetCurrentPos().Value + text.Length));
  63. }
  64. public void InsertTextAndMoveCursor(string text)
  65. {
  66. var currentPos = GetCurrentPos();
  67. InsertText(currentPos, text);
  68. GotoPos(new Position(currentPos.Value + text.Length));
  69. }
  70. public void SelectCurrentLine()
  71. {
  72. int line = GetCurrentLineNumber();
  73. SetSelection(PositionFromLine(line).Value, PositionFromLine(line + 1).Value);
  74. }
  75. /// <summary>
  76. /// clears the selection without changing the position of the cursor
  77. /// </summary>
  78. public void ClearSelectionToCursor()
  79. {
  80. var pos = GetCurrentPos().Value;
  81. SetSelection(pos, pos);
  82. }
  83. /// <summary>
  84. /// Get the current line from the current position
  85. /// </summary>
  86. public int GetCurrentLineNumber()
  87. {
  88. return LineFromPosition(GetCurrentPos());
  89. }
  90. /// <summary>
  91. /// Get the scroll information for the current Scintilla window.
  92. /// </summary>
  93. /// <param name="mask">Arguments for the scroll information such as tracking</param>
  94. /// <param name="scrollBar">Which scroll bar information are you looking for</param>
  95. /// <returns>A ScrollInfo struct with information of the current scroll state</returns>
  96. public ScrollInfo GetScrollInfo(ScrollInfoMask mask = ScrollInfoMask.SIF_ALL, ScrollInfoBar scrollBar = ScrollInfoBar.SB_BOTH)
  97. {
  98. ScrollInfo scrollInfo = new ScrollInfo();
  99. scrollInfo.cbSize = (uint)Marshal.SizeOf(scrollInfo);
  100. scrollInfo.fMask = (uint)mask;
  101. Win32.GetScrollInfo(scintilla, (int)scrollBar, ref scrollInfo);
  102. return scrollInfo;
  103. }
  104. /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
  105. /// <summary>Add text to the document at current position. (Scintilla feature 2001)</summary>
  106. public unsafe void AddText(int length, string text)
  107. {
  108. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  109. {
  110. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDTEXT, length, (IntPtr) textPtr);
  111. }
  112. }
  113. /// <summary>Add array of cells to document. (Scintilla feature 2002)</summary>
  114. public unsafe void AddStyledText(int length, Cells c)
  115. {
  116. fixed (char* cPtr = c.Value)
  117. {
  118. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDSTYLEDTEXT, length, (IntPtr) cPtr);
  119. }
  120. }
  121. /// <summary>Insert string at a position. (Scintilla feature 2003)</summary>
  122. public unsafe void InsertText(Position pos, string text)
  123. {
  124. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  125. {
  126. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INSERTTEXT, pos.Value, (IntPtr) textPtr);
  127. }
  128. }
  129. /// <summary>Change the text that is being inserted in response to SC_MOD_INSERTCHECK (Scintilla feature 2672)</summary>
  130. public unsafe void ChangeInsertion(int length, string text)
  131. {
  132. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  133. {
  134. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHANGEINSERTION, length, (IntPtr) textPtr);
  135. }
  136. }
  137. /// <summary>Delete all text in the document. (Scintilla feature 2004)</summary>
  138. public void ClearAll()
  139. {
  140. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALL, Unused, Unused);
  141. }
  142. /// <summary>Delete a range of text in the document. (Scintilla feature 2645)</summary>
  143. public void DeleteRange(Position pos, int deleteLength)
  144. {
  145. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELETERANGE, pos.Value, deleteLength);
  146. }
  147. /// <summary>Set all style bytes to 0, remove all folding information. (Scintilla feature 2005)</summary>
  148. public void ClearDocumentStyle()
  149. {
  150. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARDOCUMENTSTYLE, Unused, Unused);
  151. }
  152. /// <summary>Returns the number of bytes in the document. (Scintilla feature 2006)</summary>
  153. public int GetLength()
  154. {
  155. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLENGTH, Unused, Unused);
  156. return (int) res;
  157. }
  158. /// <summary>Returns the character byte at the position. (Scintilla feature 2007)</summary>
  159. public int GetCharAt(Position pos)
  160. {
  161. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARAT, pos.Value, Unused);
  162. return (int) res;
  163. }
  164. /// <summary>Returns the position of the caret. (Scintilla feature 2008)</summary>
  165. public Position GetCurrentPos()
  166. {
  167. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCURRENTPOS, Unused, Unused);
  168. return new Position((int) res);
  169. }
  170. /// <summary>Returns the position of the opposite end of the selection to the caret. (Scintilla feature 2009)</summary>
  171. public Position GetAnchor()
  172. {
  173. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETANCHOR, Unused, Unused);
  174. return new Position((int) res);
  175. }
  176. /// <summary>Returns the style byte at the position. (Scintilla feature 2010)</summary>
  177. public int GetStyleAt(Position pos)
  178. {
  179. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEAT, pos.Value, Unused);
  180. return (int) res;
  181. }
  182. /// <summary>Redoes the next action on the undo history. (Scintilla feature 2011)</summary>
  183. public void Redo()
  184. {
  185. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REDO, Unused, Unused);
  186. }
  187. /// <summary>
  188. /// Choose between collecting actions into the undo
  189. /// history and discarding them.
  190. /// (Scintilla feature 2012)
  191. /// </summary>
  192. public void SetUndoCollection(bool collectUndo)
  193. {
  194. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETUNDOCOLLECTION, collectUndo ? 1 : 0, Unused);
  195. }
  196. /// <summary>Select all the text in the document. (Scintilla feature 2013)</summary>
  197. public void SelectAll()
  198. {
  199. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SELECTALL, Unused, Unused);
  200. }
  201. /// <summary>
  202. /// Remember the current position in the undo history as the position
  203. /// at which the document was saved.
  204. /// (Scintilla feature 2014)
  205. /// </summary>
  206. public void SetSavePoint()
  207. {
  208. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSAVEPOINT, Unused, Unused);
  209. }
  210. /// <summary>
  211. /// Retrieve a buffer of cells.
  212. /// Returns the number of bytes in the buffer not including terminating NULs.
  213. /// (Scintilla feature 2015)
  214. /// </summary>
  215. public int GetStyledText(TextRange tr)
  216. {
  217. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEDTEXT, Unused, tr.NativePointer);
  218. return (int) res;
  219. }
  220. /// <summary>Are there any redoable actions in the undo history? (Scintilla feature 2016)</summary>
  221. public bool CanRedo()
  222. {
  223. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANREDO, Unused, Unused);
  224. return 1 == (int) res;
  225. }
  226. /// <summary>Retrieve the line number at which a particular marker is located. (Scintilla feature 2017)</summary>
  227. public int MarkerLineFromHandle(int handle)
  228. {
  229. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERLINEFROMHANDLE, handle, Unused);
  230. return (int) res;
  231. }
  232. /// <summary>Delete a marker. (Scintilla feature 2018)</summary>
  233. public void MarkerDeleteHandle(int handle)
  234. {
  235. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEHANDLE, handle, Unused);
  236. }
  237. /// <summary>Is undo history being collected? (Scintilla feature 2019)</summary>
  238. public bool GetUndoCollection()
  239. {
  240. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETUNDOCOLLECTION, Unused, Unused);
  241. return 1 == (int) res;
  242. }
  243. /// <summary>
  244. /// Are white space characters currently visible?
  245. /// Returns one of SCWS_* constants.
  246. /// (Scintilla feature 2020)
  247. /// </summary>
  248. public int GetViewWS()
  249. {
  250. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWWS, Unused, Unused);
  251. return (int) res;
  252. }
  253. /// <summary>Make white space characters invisible, always visible or visible outside indentation. (Scintilla feature 2021)</summary>
  254. public void SetViewWS(int viewWS)
  255. {
  256. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWWS, viewWS, Unused);
  257. }
  258. /// <summary>Find the position from a point within the window. (Scintilla feature 2022)</summary>
  259. public Position PositionFromPoint(int x, int y)
  260. {
  261. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINT, x, y);
  262. return new Position((int) res);
  263. }
  264. /// <summary>
  265. /// Find the position from a point within the window but return
  266. /// INVALID_POSITION if not close to text.
  267. /// (Scintilla feature 2023)
  268. /// </summary>
  269. public Position PositionFromPointClose(int x, int y)
  270. {
  271. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMPOINTCLOSE, x, y);
  272. return new Position((int) res);
  273. }
  274. /// <summary>Set caret to start of a line and ensure it is visible. (Scintilla feature 2024)</summary>
  275. public void GotoLine(int line)
  276. {
  277. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GOTOLINE, line, Unused);
  278. }
  279. /// <summary>Set caret to a position and ensure it is visible. (Scintilla feature 2025)</summary>
  280. public void GotoPos(Position pos)
  281. {
  282. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GOTOPOS, pos.Value, Unused);
  283. }
  284. /// <summary>
  285. /// Set the selection anchor to a position. The anchor is the opposite
  286. /// end of the selection from the caret.
  287. /// (Scintilla feature 2026)
  288. /// </summary>
  289. public void SetAnchor(Position posAnchor)
  290. {
  291. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETANCHOR, posAnchor.Value, Unused);
  292. }
  293. /// <summary>
  294. /// Retrieve the text of the line containing the caret.
  295. /// Returns the index of the caret on the line.
  296. /// Result is NUL-terminated.
  297. /// (Scintilla feature 2027)
  298. /// </summary>
  299. public unsafe string GetCurLine(int length)
  300. {
  301. byte[] textBuffer = new byte[10000];
  302. fixed (byte* textPtr = textBuffer)
  303. {
  304. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCURLINE, length, (IntPtr) textPtr);
  305. return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0');
  306. }
  307. }
  308. /// <summary>Retrieve the position of the last correctly styled character. (Scintilla feature 2028)</summary>
  309. public Position GetEndStyled()
  310. {
  311. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETENDSTYLED, Unused, Unused);
  312. return new Position((int) res);
  313. }
  314. /// <summary>Convert all line endings in the document to one mode. (Scintilla feature 2029)</summary>
  315. public void ConvertEOLs(int eolMode)
  316. {
  317. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CONVERTEOLS, eolMode, Unused);
  318. }
  319. /// <summary>Retrieve the current end of line mode - one of CRLF, CR, or LF. (Scintilla feature 2030)</summary>
  320. public int GetEOLMode()
  321. {
  322. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEOLMODE, Unused, Unused);
  323. return (int) res;
  324. }
  325. /// <summary>Set the current end of line mode. (Scintilla feature 2031)</summary>
  326. public void SetEOLMode(int eolMode)
  327. {
  328. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEOLMODE, eolMode, Unused);
  329. }
  330. /// <summary>
  331. /// Set the current styling position to pos and the styling mask to mask.
  332. /// The styling mask can be used to protect some bits in each styling byte from modification.
  333. /// (Scintilla feature 2032)
  334. /// </summary>
  335. public void StartStyling(Position pos, int mask)
  336. {
  337. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STARTSTYLING, pos.Value, mask);
  338. }
  339. /// <summary>
  340. /// Change style from current styling position for length characters to a style
  341. /// and move the current styling position to after this newly styled segment.
  342. /// (Scintilla feature 2033)
  343. /// </summary>
  344. public void SetStyling(int length, int style)
  345. {
  346. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLING, length, style);
  347. }
  348. /// <summary>Is drawing done first into a buffer or direct to the screen? (Scintilla feature 2034)</summary>
  349. public bool GetBufferedDraw()
  350. {
  351. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETBUFFEREDDRAW, Unused, Unused);
  352. return 1 == (int) res;
  353. }
  354. /// <summary>
  355. /// If drawing is buffered then each line of text is drawn into a bitmap buffer
  356. /// before drawing it to the screen to avoid flicker.
  357. /// (Scintilla feature 2035)
  358. /// </summary>
  359. public void SetBufferedDraw(bool buffered)
  360. {
  361. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETBUFFEREDDRAW, buffered ? 1 : 0, Unused);
  362. }
  363. /// <summary>Change the visible size of a tab to be a multiple of the width of a space character. (Scintilla feature 2036)</summary>
  364. public void SetTabWidth(int tabWidth)
  365. {
  366. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTABWIDTH, tabWidth, Unused);
  367. }
  368. /// <summary>Retrieve the visible size of a tab. (Scintilla feature 2121)</summary>
  369. public int GetTabWidth()
  370. {
  371. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTABWIDTH, Unused, Unused);
  372. return (int) res;
  373. }
  374. /// <summary>Clear explicit tabstops on a line. (Scintilla feature 2675)</summary>
  375. public void ClearTabStops(int line)
  376. {
  377. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARTABSTOPS, line, Unused);
  378. }
  379. /// <summary>Add an explicit tab stop for a line. (Scintilla feature 2676)</summary>
  380. public void AddTabStop(int line, int x)
  381. {
  382. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDTABSTOP, line, x);
  383. }
  384. /// <summary>Find the next explicit tab stop position on a line after a position. (Scintilla feature 2677)</summary>
  385. public int GetNextTabStop(int line, int x)
  386. {
  387. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETNEXTTABSTOP, line, x);
  388. return (int) res;
  389. }
  390. /// <summary>
  391. /// Set the code page used to interpret the bytes of the document as characters.
  392. /// The SC_CP_UTF8 value can be used to enter Unicode mode.
  393. /// (Scintilla feature 2037)
  394. /// </summary>
  395. public void SetCodePage(int codePage)
  396. {
  397. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCODEPAGE, codePage, Unused);
  398. }
  399. /// <summary>Is the IME displayed in a winow or inline? (Scintilla feature 2678)</summary>
  400. public int GetIMEInteraction()
  401. {
  402. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETIMEINTERACTION, Unused, Unused);
  403. return (int) res;
  404. }
  405. /// <summary>Choose to display the the IME in a winow or inline. (Scintilla feature 2679)</summary>
  406. public void SetIMEInteraction(int imeInteraction)
  407. {
  408. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETIMEINTERACTION, imeInteraction, Unused);
  409. }
  410. /// <summary>Set the symbol used for a particular marker number. (Scintilla feature 2040)</summary>
  411. public void MarkerDefine(int markerNumber, int markerSymbol)
  412. {
  413. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINE, markerNumber, markerSymbol);
  414. }
  415. /// <summary>Set the foreground colour used for a particular marker number. (Scintilla feature 2041)</summary>
  416. public void MarkerSetFore(int markerNumber, Colour fore)
  417. {
  418. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETFORE, markerNumber, fore.Value);
  419. }
  420. /// <summary>Set the background colour used for a particular marker number. (Scintilla feature 2042)</summary>
  421. public void MarkerSetBack(int markerNumber, Colour back)
  422. {
  423. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACK, markerNumber, back.Value);
  424. }
  425. /// <summary>Set the background colour used for a particular marker number when its folding block is selected. (Scintilla feature 2292)</summary>
  426. public void MarkerSetBackSelected(int markerNumber, Colour back)
  427. {
  428. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETBACKSELECTED, markerNumber, back.Value);
  429. }
  430. /// <summary>Enable/disable highlight for current folding bloc (smallest one that contains the caret) (Scintilla feature 2293)</summary>
  431. public void MarkerEnableHighlight(bool enabled)
  432. {
  433. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERENABLEHIGHLIGHT, enabled ? 1 : 0, Unused);
  434. }
  435. /// <summary>Add a marker to a line, returning an ID which can be used to find or delete the marker. (Scintilla feature 2043)</summary>
  436. public int MarkerAdd(int line, int markerNumber)
  437. {
  438. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADD, line, markerNumber);
  439. return (int) res;
  440. }
  441. /// <summary>Delete a marker from a line. (Scintilla feature 2044)</summary>
  442. public void MarkerDelete(int line, int markerNumber)
  443. {
  444. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETE, line, markerNumber);
  445. }
  446. /// <summary>Delete all markers with a particular number from all lines. (Scintilla feature 2045)</summary>
  447. public void MarkerDeleteAll(int markerNumber)
  448. {
  449. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDELETEALL, markerNumber, Unused);
  450. }
  451. /// <summary>Get a bit mask of all the markers set on a line. (Scintilla feature 2046)</summary>
  452. public int MarkerGet(int line)
  453. {
  454. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERGET, line, Unused);
  455. return (int) res;
  456. }
  457. /// <summary>
  458. /// Find the next line at or after lineStart that includes a marker in mask.
  459. /// Return -1 when no more lines.
  460. /// (Scintilla feature 2047)
  461. /// </summary>
  462. public int MarkerNext(int lineStart, int markerMask)
  463. {
  464. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERNEXT, lineStart, markerMask);
  465. return (int) res;
  466. }
  467. /// <summary>Find the previous line before lineStart that includes a marker in mask. (Scintilla feature 2048)</summary>
  468. public int MarkerPrevious(int lineStart, int markerMask)
  469. {
  470. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERPREVIOUS, lineStart, markerMask);
  471. return (int) res;
  472. }
  473. /// <summary>Define a marker from a pixmap. (Scintilla feature 2049)</summary>
  474. public unsafe void MarkerDefinePixmap(int markerNumber, string pixmap)
  475. {
  476. fixed (byte* pixmapPtr = Encoding.UTF8.GetBytes(pixmap))
  477. {
  478. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINEPIXMAP, markerNumber, (IntPtr) pixmapPtr);
  479. }
  480. }
  481. /// <summary>Add a set of markers to a line. (Scintilla feature 2466)</summary>
  482. public void MarkerAddSet(int line, int set)
  483. {
  484. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERADDSET, line, set);
  485. }
  486. /// <summary>Set the alpha used for a marker that is drawn in the text area, not the margin. (Scintilla feature 2476)</summary>
  487. public void MarkerSetAlpha(int markerNumber, int alpha)
  488. {
  489. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSETALPHA, markerNumber, alpha);
  490. }
  491. /// <summary>Set a margin to be either numeric or symbolic. (Scintilla feature 2240)</summary>
  492. public void SetMarginTypeN(int margin, int marginType)
  493. {
  494. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINTYPEN, margin, marginType);
  495. }
  496. /// <summary>Retrieve the type of a margin. (Scintilla feature 2241)</summary>
  497. public int GetMarginTypeN(int margin)
  498. {
  499. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINTYPEN, margin, Unused);
  500. return (int) res;
  501. }
  502. /// <summary>Set the width of a margin to a width expressed in pixels. (Scintilla feature 2242)</summary>
  503. public void SetMarginWidthN(int margin, int pixelWidth)
  504. {
  505. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINWIDTHN, margin, pixelWidth);
  506. }
  507. /// <summary>Retrieve the width of a margin in pixels. (Scintilla feature 2243)</summary>
  508. public int GetMarginWidthN(int margin)
  509. {
  510. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINWIDTHN, margin, Unused);
  511. return (int) res;
  512. }
  513. /// <summary>Set a mask that determines which markers are displayed in a margin. (Scintilla feature 2244)</summary>
  514. public void SetMarginMaskN(int margin, int mask)
  515. {
  516. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINMASKN, margin, mask);
  517. }
  518. /// <summary>Retrieve the marker mask of a margin. (Scintilla feature 2245)</summary>
  519. public int GetMarginMaskN(int margin)
  520. {
  521. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINMASKN, margin, Unused);
  522. return (int) res;
  523. }
  524. /// <summary>Make a margin sensitive or insensitive to mouse clicks. (Scintilla feature 2246)</summary>
  525. public void SetMarginSensitiveN(int margin, bool sensitive)
  526. {
  527. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINSENSITIVEN, margin, sensitive ? 1 : 0);
  528. }
  529. /// <summary>Retrieve the mouse click sensitivity of a margin. (Scintilla feature 2247)</summary>
  530. public bool GetMarginSensitiveN(int margin)
  531. {
  532. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINSENSITIVEN, margin, Unused);
  533. return 1 == (int) res;
  534. }
  535. /// <summary>Set the cursor shown when the mouse is inside a margin. (Scintilla feature 2248)</summary>
  536. public void SetMarginCursorN(int margin, int cursor)
  537. {
  538. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINCURSORN, margin, cursor);
  539. }
  540. /// <summary>Retrieve the cursor shown in a margin. (Scintilla feature 2249)</summary>
  541. public int GetMarginCursorN(int margin)
  542. {
  543. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINCURSORN, margin, Unused);
  544. return (int) res;
  545. }
  546. /// <summary>Clear all the styles and make equivalent to the global default style. (Scintilla feature 2050)</summary>
  547. public void StyleClearAll()
  548. {
  549. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLECLEARALL, Unused, Unused);
  550. }
  551. /// <summary>Set the foreground colour of a style. (Scintilla feature 2051)</summary>
  552. public void StyleSetFore(int style, Colour fore)
  553. {
  554. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFORE, style, fore.Value);
  555. }
  556. /// <summary>Set the background colour of a style. (Scintilla feature 2052)</summary>
  557. public void StyleSetBack(int style, Colour back)
  558. {
  559. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBACK, style, back.Value);
  560. }
  561. /// <summary>Set a style to be bold or not. (Scintilla feature 2053)</summary>
  562. public void StyleSetBold(int style, bool bold)
  563. {
  564. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETBOLD, style, bold ? 1 : 0);
  565. }
  566. /// <summary>Set a style to be italic or not. (Scintilla feature 2054)</summary>
  567. public void StyleSetItalic(int style, bool italic)
  568. {
  569. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETITALIC, style, italic ? 1 : 0);
  570. }
  571. /// <summary>Set the size of characters of a style. (Scintilla feature 2055)</summary>
  572. public void StyleSetSize(int style, int sizePoints)
  573. {
  574. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZE, style, sizePoints);
  575. }
  576. /// <summary>Set the font of a style. (Scintilla feature 2056)</summary>
  577. public unsafe void StyleSetFont(int style, string fontName)
  578. {
  579. fixed (byte* fontNamePtr = Encoding.UTF8.GetBytes(fontName))
  580. {
  581. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETFONT, style, (IntPtr) fontNamePtr);
  582. }
  583. }
  584. /// <summary>Set a style to have its end of line filled or not. (Scintilla feature 2057)</summary>
  585. public void StyleSetEOLFilled(int style, bool filled)
  586. {
  587. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETEOLFILLED, style, filled ? 1 : 0);
  588. }
  589. /// <summary>Reset the default style to its state at startup (Scintilla feature 2058)</summary>
  590. public void StyleResetDefault()
  591. {
  592. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLERESETDEFAULT, Unused, Unused);
  593. }
  594. /// <summary>Set a style to be underlined or not. (Scintilla feature 2059)</summary>
  595. public void StyleSetUnderline(int style, bool underline)
  596. {
  597. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETUNDERLINE, style, underline ? 1 : 0);
  598. }
  599. /// <summary>Get the foreground colour of a style. (Scintilla feature 2481)</summary>
  600. public Colour StyleGetFore(int style)
  601. {
  602. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETFORE, style, Unused);
  603. return new Colour((int) res);
  604. }
  605. /// <summary>Get the background colour of a style. (Scintilla feature 2482)</summary>
  606. public Colour StyleGetBack(int style)
  607. {
  608. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBACK, style, Unused);
  609. return new Colour((int) res);
  610. }
  611. /// <summary>Get is a style bold or not. (Scintilla feature 2483)</summary>
  612. public bool StyleGetBold(int style)
  613. {
  614. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETBOLD, style, Unused);
  615. return 1 == (int) res;
  616. }
  617. /// <summary>Get is a style italic or not. (Scintilla feature 2484)</summary>
  618. public bool StyleGetItalic(int style)
  619. {
  620. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETITALIC, style, Unused);
  621. return 1 == (int) res;
  622. }
  623. /// <summary>Get the size of characters of a style. (Scintilla feature 2485)</summary>
  624. public int StyleGetSize(int style)
  625. {
  626. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZE, style, Unused);
  627. return (int) res;
  628. }
  629. /// <summary>
  630. /// Get the font of a style.
  631. /// Returns the length of the fontName
  632. /// Result is NUL-terminated.
  633. /// (Scintilla feature 2486)
  634. /// </summary>
  635. public unsafe string StyleGetFont(int style)
  636. {
  637. byte[] fontNameBuffer = new byte[10000];
  638. fixed (byte* fontNamePtr = fontNameBuffer)
  639. {
  640. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETFONT, style, (IntPtr) fontNamePtr);
  641. return Encoding.UTF8.GetString(fontNameBuffer).TrimEnd('\0');
  642. }
  643. }
  644. /// <summary>Get is a style to have its end of line filled or not. (Scintilla feature 2487)</summary>
  645. public bool StyleGetEOLFilled(int style)
  646. {
  647. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETEOLFILLED, style, Unused);
  648. return 1 == (int) res;
  649. }
  650. /// <summary>Get is a style underlined or not. (Scintilla feature 2488)</summary>
  651. public bool StyleGetUnderline(int style)
  652. {
  653. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETUNDERLINE, style, Unused);
  654. return 1 == (int) res;
  655. }
  656. /// <summary>Get is a style mixed case, or to force upper or lower case. (Scintilla feature 2489)</summary>
  657. public int StyleGetCase(int style)
  658. {
  659. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCASE, style, Unused);
  660. return (int) res;
  661. }
  662. /// <summary>Get the character get of the font in a style. (Scintilla feature 2490)</summary>
  663. public int StyleGetCharacterSet(int style)
  664. {
  665. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHARACTERSET, style, Unused);
  666. return (int) res;
  667. }
  668. /// <summary>Get is a style visible or not. (Scintilla feature 2491)</summary>
  669. public bool StyleGetVisible(int style)
  670. {
  671. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETVISIBLE, style, Unused);
  672. return 1 == (int) res;
  673. }
  674. /// <summary>
  675. /// Get is a style changeable or not (read only).
  676. /// Experimental feature, currently buggy.
  677. /// (Scintilla feature 2492)
  678. /// </summary>
  679. public bool StyleGetChangeable(int style)
  680. {
  681. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETCHANGEABLE, style, Unused);
  682. return 1 == (int) res;
  683. }
  684. /// <summary>Get is a style a hotspot or not. (Scintilla feature 2493)</summary>
  685. public bool StyleGetHotSpot(int style)
  686. {
  687. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETHOTSPOT, style, Unused);
  688. return 1 == (int) res;
  689. }
  690. /// <summary>Set a style to be mixed case, or to force upper or lower case. (Scintilla feature 2060)</summary>
  691. public void StyleSetCase(int style, int caseForce)
  692. {
  693. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCASE, style, caseForce);
  694. }
  695. /// <summary>Set the size of characters of a style. Size is in points multiplied by 100. (Scintilla feature 2061)</summary>
  696. public void StyleSetSizeFractional(int style, int caseForce)
  697. {
  698. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETSIZEFRACTIONAL, style, caseForce);
  699. }
  700. /// <summary>Get the size of characters of a style in points multiplied by 100 (Scintilla feature 2062)</summary>
  701. public int StyleGetSizeFractional(int style)
  702. {
  703. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETSIZEFRACTIONAL, style, Unused);
  704. return (int) res;
  705. }
  706. /// <summary>Set the weight of characters of a style. (Scintilla feature 2063)</summary>
  707. public void StyleSetWeight(int style, int weight)
  708. {
  709. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETWEIGHT, style, weight);
  710. }
  711. /// <summary>Get the weight of characters of a style. (Scintilla feature 2064)</summary>
  712. public int StyleGetWeight(int style)
  713. {
  714. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLEGETWEIGHT, style, Unused);
  715. return (int) res;
  716. }
  717. /// <summary>Set the character set of the font in a style. (Scintilla feature 2066)</summary>
  718. public void StyleSetCharacterSet(int style, int characterSet)
  719. {
  720. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHARACTERSET, style, characterSet);
  721. }
  722. /// <summary>Set a style to be a hotspot or not. (Scintilla feature 2409)</summary>
  723. public void StyleSetHotSpot(int style, bool hotspot)
  724. {
  725. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETHOTSPOT, style, hotspot ? 1 : 0);
  726. }
  727. /// <summary>Set the foreground colour of the main and additional selections and whether to use this setting. (Scintilla feature 2067)</summary>
  728. public void SetSelFore(bool useSetting, Colour fore)
  729. {
  730. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELFORE, useSetting ? 1 : 0, fore.Value);
  731. }
  732. /// <summary>Set the background colour of the main and additional selections and whether to use this setting. (Scintilla feature 2068)</summary>
  733. public void SetSelBack(bool useSetting, Colour back)
  734. {
  735. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELBACK, useSetting ? 1 : 0, back.Value);
  736. }
  737. /// <summary>Get the alpha of the selection. (Scintilla feature 2477)</summary>
  738. public int GetSelAlpha()
  739. {
  740. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELALPHA, Unused, Unused);
  741. return (int) res;
  742. }
  743. /// <summary>Set the alpha of the selection. (Scintilla feature 2478)</summary>
  744. public void SetSelAlpha(int alpha)
  745. {
  746. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELALPHA, alpha, Unused);
  747. }
  748. /// <summary>Is the selection end of line filled? (Scintilla feature 2479)</summary>
  749. public bool GetSelEOLFilled()
  750. {
  751. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELEOLFILLED, Unused, Unused);
  752. return 1 == (int) res;
  753. }
  754. /// <summary>Set the selection to have its end of line filled or not. (Scintilla feature 2480)</summary>
  755. public void SetSelEOLFilled(bool filled)
  756. {
  757. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELEOLFILLED, filled ? 1 : 0, Unused);
  758. }
  759. /// <summary>Set the foreground colour of the caret. (Scintilla feature 2069)</summary>
  760. public void SetCaretFore(Colour fore)
  761. {
  762. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETFORE, fore.Value, Unused);
  763. }
  764. /// <summary>When key+modifier combination km is pressed perform msg. (Scintilla feature 2070)</summary>
  765. public void AssignCmdKey(KeyModifier km, int msg)
  766. {
  767. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ASSIGNCMDKEY, km.Value, msg);
  768. }
  769. /// <summary>When key+modifier combination km is pressed do nothing. (Scintilla feature 2071)</summary>
  770. public void ClearCmdKey(KeyModifier km)
  771. {
  772. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARCMDKEY, km.Value, Unused);
  773. }
  774. /// <summary>Drop all key mappings. (Scintilla feature 2072)</summary>
  775. public void ClearAllCmdKeys()
  776. {
  777. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARALLCMDKEYS, Unused, Unused);
  778. }
  779. /// <summary>Set the styles for a segment of the document. (Scintilla feature 2073)</summary>
  780. public unsafe void SetStylingEx(int length, string styles)
  781. {
  782. fixed (byte* stylesPtr = Encoding.UTF8.GetBytes(styles))
  783. {
  784. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLINGEX, length, (IntPtr) stylesPtr);
  785. }
  786. }
  787. /// <summary>Set a style to be visible or not. (Scintilla feature 2074)</summary>
  788. public void StyleSetVisible(int style, bool visible)
  789. {
  790. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETVISIBLE, style, visible ? 1 : 0);
  791. }
  792. /// <summary>Get the time in milliseconds that the caret is on and off. (Scintilla feature 2075)</summary>
  793. public int GetCaretPeriod()
  794. {
  795. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETPERIOD, Unused, Unused);
  796. return (int) res;
  797. }
  798. /// <summary>Get the time in milliseconds that the caret is on and off. 0 = steady on. (Scintilla feature 2076)</summary>
  799. public void SetCaretPeriod(int periodMilliseconds)
  800. {
  801. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETPERIOD, periodMilliseconds, Unused);
  802. }
  803. /// <summary>
  804. /// Set the set of characters making up words for when moving or selecting by word.
  805. /// First sets defaults like SetCharsDefault.
  806. /// (Scintilla feature 2077)
  807. /// </summary>
  808. public unsafe void SetWordChars(string characters)
  809. {
  810. fixed (byte* charactersPtr = Encoding.UTF8.GetBytes(characters))
  811. {
  812. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWORDCHARS, Unused, (IntPtr) charactersPtr);
  813. }
  814. }
  815. /// <summary>
  816. /// Get the set of characters making up words for when moving or selecting by word.
  817. /// Returns the number of characters
  818. /// (Scintilla feature 2646)
  819. /// </summary>
  820. public unsafe string GetWordChars()
  821. {
  822. byte[] charactersBuffer = new byte[10000];
  823. fixed (byte* charactersPtr = charactersBuffer)
  824. {
  825. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWORDCHARS, Unused, (IntPtr) charactersPtr);
  826. return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0');
  827. }
  828. }
  829. /// <summary>
  830. /// Start a sequence of actions that is undone and redone as a unit.
  831. /// May be nested.
  832. /// (Scintilla feature 2078)
  833. /// </summary>
  834. public void BeginUndoAction()
  835. {
  836. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BEGINUNDOACTION, Unused, Unused);
  837. }
  838. /// <summary>End a sequence of actions that is undone and redone as a unit. (Scintilla feature 2079)</summary>
  839. public void EndUndoAction()
  840. {
  841. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENDUNDOACTION, Unused, Unused);
  842. }
  843. /// <summary>Set an indicator to plain, squiggle or TT. (Scintilla feature 2080)</summary>
  844. public void IndicSetStyle(int indic, int style)
  845. {
  846. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETSTYLE, indic, style);
  847. }
  848. /// <summary>Retrieve the style of an indicator. (Scintilla feature 2081)</summary>
  849. public int IndicGetStyle(int indic)
  850. {
  851. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETSTYLE, indic, Unused);
  852. return (int) res;
  853. }
  854. /// <summary>Set the foreground colour of an indicator. (Scintilla feature 2082)</summary>
  855. public void IndicSetFore(int indic, Colour fore)
  856. {
  857. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFORE, indic, fore.Value);
  858. }
  859. /// <summary>Retrieve the foreground colour of an indicator. (Scintilla feature 2083)</summary>
  860. public Colour IndicGetFore(int indic)
  861. {
  862. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFORE, indic, Unused);
  863. return new Colour((int) res);
  864. }
  865. /// <summary>Set an indicator to draw under text or over(default). (Scintilla feature 2510)</summary>
  866. public void IndicSetUnder(int indic, bool under)
  867. {
  868. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETUNDER, indic, under ? 1 : 0);
  869. }
  870. /// <summary>Retrieve whether indicator drawn under or over text. (Scintilla feature 2511)</summary>
  871. public bool IndicGetUnder(int indic)
  872. {
  873. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETUNDER, indic, Unused);
  874. return 1 == (int) res;
  875. }
  876. /// <summary>Set a hover indicator to plain, squiggle or TT. (Scintilla feature 2680)</summary>
  877. public void IndicSetHoverStyle(int indic, int style)
  878. {
  879. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERSTYLE, indic, style);
  880. }
  881. /// <summary>Retrieve the hover style of an indicator. (Scintilla feature 2681)</summary>
  882. public int IndicGetHoverStyle(int indic)
  883. {
  884. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERSTYLE, indic, Unused);
  885. return (int) res;
  886. }
  887. /// <summary>Set the foreground hover colour of an indicator. (Scintilla feature 2682)</summary>
  888. public void IndicSetHoverFore(int indic, Colour fore)
  889. {
  890. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETHOVERFORE, indic, fore.Value);
  891. }
  892. /// <summary>Retrieve the foreground hover colour of an indicator. (Scintilla feature 2683)</summary>
  893. public Colour IndicGetHoverFore(int indic)
  894. {
  895. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETHOVERFORE, indic, Unused);
  896. return new Colour((int) res);
  897. }
  898. /// <summary>Set the attributes of an indicator. (Scintilla feature 2684)</summary>
  899. public void IndicSetFlags(int indic, int flags)
  900. {
  901. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETFLAGS, indic, flags);
  902. }
  903. /// <summary>Retrieve the attributes of an indicator. (Scintilla feature 2685)</summary>
  904. public int IndicGetFlags(int indic)
  905. {
  906. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETFLAGS, indic, Unused);
  907. return (int) res;
  908. }
  909. /// <summary>Set the foreground colour of all whitespace and whether to use this setting. (Scintilla feature 2084)</summary>
  910. public void SetWhitespaceFore(bool useSetting, Colour fore)
  911. {
  912. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEFORE, useSetting ? 1 : 0, fore.Value);
  913. }
  914. /// <summary>Set the background colour of all whitespace and whether to use this setting. (Scintilla feature 2085)</summary>
  915. public void SetWhitespaceBack(bool useSetting, Colour back)
  916. {
  917. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACEBACK, useSetting ? 1 : 0, back.Value);
  918. }
  919. /// <summary>Set the size of the dots used to mark space characters. (Scintilla feature 2086)</summary>
  920. public void SetWhitespaceSize(int size)
  921. {
  922. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACESIZE, size, Unused);
  923. }
  924. /// <summary>Get the size of the dots used to mark space characters. (Scintilla feature 2087)</summary>
  925. public int GetWhitespaceSize()
  926. {
  927. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWHITESPACESIZE, Unused, Unused);
  928. return (int) res;
  929. }
  930. /// <summary>
  931. /// Divide each styling byte into lexical class bits (default: 5) and indicator
  932. /// bits (default: 3). If a lexer requires more than 32 lexical states, then this
  933. /// is used to expand the possible states.
  934. /// (Scintilla feature 2090)
  935. /// </summary>
  936. public void SetStyleBits(int bits)
  937. {
  938. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTYLEBITS, bits, Unused);
  939. }
  940. /// <summary>Retrieve number of bits in style bytes used to hold the lexical state. (Scintilla feature 2091)</summary>
  941. public int GetStyleBits()
  942. {
  943. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITS, Unused, Unused);
  944. return (int) res;
  945. }
  946. /// <summary>Used to hold extra styling information for each line. (Scintilla feature 2092)</summary>
  947. public void SetLineState(int line, int state)
  948. {
  949. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLINESTATE, line, state);
  950. }
  951. /// <summary>Retrieve the extra styling information for a line. (Scintilla feature 2093)</summary>
  952. public int GetLineState(int line)
  953. {
  954. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESTATE, line, Unused);
  955. return (int) res;
  956. }
  957. /// <summary>Retrieve the last line number that has line state. (Scintilla feature 2094)</summary>
  958. public int GetMaxLineState()
  959. {
  960. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMAXLINESTATE, Unused, Unused);
  961. return (int) res;
  962. }
  963. /// <summary>Is the background of the line containing the caret in a different colour? (Scintilla feature 2095)</summary>
  964. public bool GetCaretLineVisible()
  965. {
  966. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLE, Unused, Unused);
  967. return 1 == (int) res;
  968. }
  969. /// <summary>Display the background of the line containing the caret in a different colour. (Scintilla feature 2096)</summary>
  970. public void SetCaretLineVisible(bool show)
  971. {
  972. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLE, show ? 1 : 0, Unused);
  973. }
  974. /// <summary>Get the colour of the background of the line containing the caret. (Scintilla feature 2097)</summary>
  975. public Colour GetCaretLineBack()
  976. {
  977. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACK, Unused, Unused);
  978. return new Colour((int) res);
  979. }
  980. /// <summary>Set the colour of the background of the line containing the caret. (Scintilla feature 2098)</summary>
  981. public void SetCaretLineBack(Colour back)
  982. {
  983. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACK, back.Value, Unused);
  984. }
  985. /// <summary>
  986. /// Set a style to be changeable or not (read only).
  987. /// Experimental feature, currently buggy.
  988. /// (Scintilla feature 2099)
  989. /// </summary>
  990. public void StyleSetChangeable(int style, bool changeable)
  991. {
  992. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STYLESETCHANGEABLE, style, changeable ? 1 : 0);
  993. }
  994. /// <summary>
  995. /// Display a auto-completion list.
  996. /// The lenEntered parameter indicates how many characters before
  997. /// the caret should be used to provide context.
  998. /// (Scintilla feature 2100)
  999. /// </summary>
  1000. public unsafe void AutoCShow(int lenEntered, string itemList)
  1001. {
  1002. fixed (byte* itemListPtr = Encoding.UTF8.GetBytes(itemList))
  1003. {
  1004. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSHOW, lenEntered, (IntPtr) itemListPtr);
  1005. }
  1006. }
  1007. /// <summary>Remove the auto-completion list from the screen. (Scintilla feature 2101)</summary>
  1008. public void AutoCCancel()
  1009. {
  1010. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCANCEL, Unused, Unused);
  1011. }
  1012. /// <summary>Is there an auto-completion list visible? (Scintilla feature 2102)</summary>
  1013. public bool AutoCActive()
  1014. {
  1015. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCACTIVE, Unused, Unused);
  1016. return 1 == (int) res;
  1017. }
  1018. /// <summary>Retrieve the position of the caret when the auto-completion list was displayed. (Scintilla feature 2103)</summary>
  1019. public Position AutoCPosStart()
  1020. {
  1021. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCPOSSTART, Unused, Unused);
  1022. return new Position((int) res);
  1023. }
  1024. /// <summary>User has selected an item so remove the list and insert the selection. (Scintilla feature 2104)</summary>
  1025. public void AutoCComplete()
  1026. {
  1027. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCCOMPLETE, Unused, Unused);
  1028. }
  1029. /// <summary>Define a set of character that when typed cancel the auto-completion list. (Scintilla feature 2105)</summary>
  1030. public unsafe void AutoCStops(string characterSet)
  1031. {
  1032. fixed (byte* characterSetPtr = Encoding.UTF8.GetBytes(characterSet))
  1033. {
  1034. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSTOPS, Unused, (IntPtr) characterSetPtr);
  1035. }
  1036. }
  1037. /// <summary>
  1038. /// Change the separator character in the string setting up an auto-completion list.
  1039. /// Default is space but can be changed if items contain space.
  1040. /// (Scintilla feature 2106)
  1041. /// </summary>
  1042. public void AutoCSetSeparator(int separatorCharacter)
  1043. {
  1044. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETSEPARATOR, separatorCharacter, Unused);
  1045. }
  1046. /// <summary>Retrieve the auto-completion list separator character. (Scintilla feature 2107)</summary>
  1047. public int AutoCGetSeparator()
  1048. {
  1049. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETSEPARATOR, Unused, Unused);
  1050. return (int) res;
  1051. }
  1052. /// <summary>Select the item in the auto-completion list that starts with a string. (Scintilla feature 2108)</summary>
  1053. public unsafe void AutoCSelect(string text)
  1054. {
  1055. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  1056. {
  1057. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSELECT, Unused, (IntPtr) textPtr);
  1058. }
  1059. }
  1060. /// <summary>
  1061. /// Should the auto-completion list be cancelled if the user backspaces to a
  1062. /// position before where the box was created.
  1063. /// (Scintilla feature 2110)
  1064. /// </summary>
  1065. public void AutoCSetCancelAtStart(bool cancel)
  1066. {
  1067. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCANCELATSTART, cancel ? 1 : 0, Unused);
  1068. }
  1069. /// <summary>Retrieve whether auto-completion cancelled by backspacing before start. (Scintilla feature 2111)</summary>
  1070. public bool AutoCGetCancelAtStart()
  1071. {
  1072. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCANCELATSTART, Unused, Unused);
  1073. return 1 == (int) res;
  1074. }
  1075. /// <summary>
  1076. /// Define a set of characters that when typed will cause the autocompletion to
  1077. /// choose the selected item.
  1078. /// (Scintilla feature 2112)
  1079. /// </summary>
  1080. public unsafe void AutoCSetFillUps(string characterSet)
  1081. {
  1082. fixed (byte* characterSetPtr = Encoding.UTF8.GetBytes(characterSet))
  1083. {
  1084. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETFILLUPS, Unused, (IntPtr) characterSetPtr);
  1085. }
  1086. }
  1087. /// <summary>Should a single item auto-completion list automatically choose the item. (Scintilla feature 2113)</summary>
  1088. public void AutoCSetChooseSingle(bool chooseSingle)
  1089. {
  1090. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCHOOSESINGLE, chooseSingle ? 1 : 0, Unused);
  1091. }
  1092. /// <summary>Retrieve whether a single item auto-completion list automatically choose the item. (Scintilla feature 2114)</summary>
  1093. public bool AutoCGetChooseSingle()
  1094. {
  1095. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCHOOSESINGLE, Unused, Unused);
  1096. return 1 == (int) res;
  1097. }
  1098. /// <summary>Set whether case is significant when performing auto-completion searches. (Scintilla feature 2115)</summary>
  1099. public void AutoCSetIgnoreCase(bool ignoreCase)
  1100. {
  1101. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETIGNORECASE, ignoreCase ? 1 : 0, Unused);
  1102. }
  1103. /// <summary>Retrieve state of ignore case flag. (Scintilla feature 2116)</summary>
  1104. public bool AutoCGetIgnoreCase()
  1105. {
  1106. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETIGNORECASE, Unused, Unused);
  1107. return 1 == (int) res;
  1108. }
  1109. /// <summary>Display a list of strings and send notification when user chooses one. (Scintilla feature 2117)</summary>
  1110. public unsafe void UserListShow(int listType, string itemList)
  1111. {
  1112. fixed (byte* itemListPtr = Encoding.UTF8.GetBytes(itemList))
  1113. {
  1114. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_USERLISTSHOW, listType, (IntPtr) itemListPtr);
  1115. }
  1116. }
  1117. /// <summary>Set whether or not autocompletion is hidden automatically when nothing matches. (Scintilla feature 2118)</summary>
  1118. public void AutoCSetAutoHide(bool autoHide)
  1119. {
  1120. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETAUTOHIDE, autoHide ? 1 : 0, Unused);
  1121. }
  1122. /// <summary>Retrieve whether or not autocompletion is hidden automatically when nothing matches. (Scintilla feature 2119)</summary>
  1123. public bool AutoCGetAutoHide()
  1124. {
  1125. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETAUTOHIDE, Unused, Unused);
  1126. return 1 == (int) res;
  1127. }
  1128. /// <summary>
  1129. /// Set whether or not autocompletion deletes any word characters
  1130. /// after the inserted text upon completion.
  1131. /// (Scintilla feature 2270)
  1132. /// </summary>
  1133. public void AutoCSetDropRestOfWord(bool dropRestOfWord)
  1134. {
  1135. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETDROPRESTOFWORD, dropRestOfWord ? 1 : 0, Unused);
  1136. }
  1137. /// <summary>
  1138. /// Retrieve whether or not autocompletion deletes any word characters
  1139. /// after the inserted text upon completion.
  1140. /// (Scintilla feature 2271)
  1141. /// </summary>
  1142. public bool AutoCGetDropRestOfWord()
  1143. {
  1144. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETDROPRESTOFWORD, Unused, Unused);
  1145. return 1 == (int) res;
  1146. }
  1147. /// <summary>Register an XPM image for use in autocompletion lists. (Scintilla feature 2405)</summary>
  1148. public unsafe void RegisterImage(int type, string xpmData)
  1149. {
  1150. fixed (byte* xpmDataPtr = Encoding.UTF8.GetBytes(xpmData))
  1151. {
  1152. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERIMAGE, type, (IntPtr) xpmDataPtr);
  1153. }
  1154. }
  1155. /// <summary>Clear all the registered XPM images. (Scintilla feature 2408)</summary>
  1156. public void ClearRegisteredImages()
  1157. {
  1158. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREGISTEREDIMAGES, Unused, Unused);
  1159. }
  1160. /// <summary>Retrieve the auto-completion list type-separator character. (Scintilla feature 2285)</summary>
  1161. public int AutoCGetTypeSeparator()
  1162. {
  1163. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETTYPESEPARATOR, Unused, Unused);
  1164. return (int) res;
  1165. }
  1166. /// <summary>
  1167. /// Change the type-separator character in the string setting up an auto-completion list.
  1168. /// Default is '?' but can be changed if items contain '?'.
  1169. /// (Scintilla feature 2286)
  1170. /// </summary>
  1171. public void AutoCSetTypeSeparator(int separatorCharacter)
  1172. {
  1173. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETTYPESEPARATOR, separatorCharacter, Unused);
  1174. }
  1175. /// <summary>
  1176. /// Set the maximum width, in characters, of auto-completion and user lists.
  1177. /// Set to 0 to autosize to fit longest item, which is the default.
  1178. /// (Scintilla feature 2208)
  1179. /// </summary>
  1180. public void AutoCSetMaxWidth(int characterCount)
  1181. {
  1182. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXWIDTH, characterCount, Unused);
  1183. }
  1184. /// <summary>Get the maximum width, in characters, of auto-completion and user lists. (Scintilla feature 2209)</summary>
  1185. public int AutoCGetMaxWidth()
  1186. {
  1187. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXWIDTH, Unused, Unused);
  1188. return (int) res;
  1189. }
  1190. /// <summary>
  1191. /// Set the maximum height, in rows, of auto-completion and user lists.
  1192. /// The default is 5 rows.
  1193. /// (Scintilla feature 2210)
  1194. /// </summary>
  1195. public void AutoCSetMaxHeight(int rowCount)
  1196. {
  1197. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMAXHEIGHT, rowCount, Unused);
  1198. }
  1199. /// <summary>Set the maximum height, in rows, of auto-completion and user lists. (Scintilla feature 2211)</summary>
  1200. public int AutoCGetMaxHeight()
  1201. {
  1202. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMAXHEIGHT, Unused, Unused);
  1203. return (int) res;
  1204. }
  1205. /// <summary>Set the number of spaces used for one level of indentation. (Scintilla feature 2122)</summary>
  1206. public void SetIndent(int indentSize)
  1207. {
  1208. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENT, indentSize, Unused);
  1209. }
  1210. /// <summary>Retrieve indentation size. (Scintilla feature 2123)</summary>
  1211. public int GetIndent()
  1212. {
  1213. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENT, Unused, Unused);
  1214. return (int) res;
  1215. }
  1216. /// <summary>
  1217. /// Indentation will only use space characters if useTabs is false, otherwise
  1218. /// it will use a combination of tabs and spaces.
  1219. /// (Scintilla feature 2124)
  1220. /// </summary>
  1221. public void SetUseTabs(bool useTabs)
  1222. {
  1223. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETUSETABS, useTabs ? 1 : 0, Unused);
  1224. }
  1225. /// <summary>Retrieve whether tabs will be used in indentation. (Scintilla feature 2125)</summary>
  1226. public bool GetUseTabs()
  1227. {
  1228. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETUSETABS, Unused, Unused);
  1229. return 1 == (int) res;
  1230. }
  1231. /// <summary>Change the indentation of a line to a number of columns. (Scintilla feature 2126)</summary>
  1232. public void SetLineIndentation(int line, int indentSize)
  1233. {
  1234. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEINDENTATION, line, indentSize);
  1235. }
  1236. /// <summary>Retrieve the number of columns that a line is indented. (Scintilla feature 2127)</summary>
  1237. public int GetLineIndentation(int line)
  1238. {
  1239. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTATION, line, Unused);
  1240. return (int) res;
  1241. }
  1242. /// <summary>Retrieve the position before the first non indentation character on a line. (Scintilla feature 2128)</summary>
  1243. public Position GetLineIndentPosition(int line)
  1244. {
  1245. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEINDENTPOSITION, line, Unused);
  1246. return new Position((int) res);
  1247. }
  1248. /// <summary>Retrieve the column number of a position, taking tab width into account. (Scintilla feature 2129)</summary>
  1249. public int GetColumn(Position pos)
  1250. {
  1251. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCOLUMN, pos.Value, Unused);
  1252. return (int) res;
  1253. }
  1254. /// <summary>Count characters between two positions. (Scintilla feature 2633)</summary>
  1255. public int CountCharacters(int startPos, int endPos)
  1256. {
  1257. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COUNTCHARACTERS, startPos, endPos);
  1258. return (int) res;
  1259. }
  1260. /// <summary>Show or hide the horizontal scroll bar. (Scintilla feature 2130)</summary>
  1261. public void SetHScrollBar(bool show)
  1262. {
  1263. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHSCROLLBAR, show ? 1 : 0, Unused);
  1264. }
  1265. /// <summary>Is the horizontal scroll bar visible? (Scintilla feature 2131)</summary>
  1266. public bool GetHScrollBar()
  1267. {
  1268. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHSCROLLBAR, Unused, Unused);
  1269. return 1 == (int) res;
  1270. }
  1271. /// <summary>Show or hide indentation guides. (Scintilla feature 2132)</summary>
  1272. public void SetIndentationGuides(int indentView)
  1273. {
  1274. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDENTATIONGUIDES, indentView, Unused);
  1275. }
  1276. /// <summary>Are the indentation guides visible? (Scintilla feature 2133)</summary>
  1277. public int GetIndentationGuides()
  1278. {
  1279. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDENTATIONGUIDES, Unused, Unused);
  1280. return (int) res;
  1281. }
  1282. /// <summary>
  1283. /// Set the highlighted indentation guide column.
  1284. /// 0 = no highlighted guide.
  1285. /// (Scintilla feature 2134)
  1286. /// </summary>
  1287. public void SetHighlightGuide(int column)
  1288. {
  1289. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHIGHLIGHTGUIDE, column, Unused);
  1290. }
  1291. /// <summary>Get the highlighted indentation guide column. (Scintilla feature 2135)</summary>
  1292. public int GetHighlightGuide()
  1293. {
  1294. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHIGHLIGHTGUIDE, Unused, Unused);
  1295. return (int) res;
  1296. }
  1297. /// <summary>Get the position after the last visible characters on a line. (Scintilla feature 2136)</summary>
  1298. public Position GetLineEndPosition(int line)
  1299. {
  1300. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDPOSITION, line, Unused);
  1301. return new Position((int) res);
  1302. }
  1303. /// <summary>Get the code page used to interpret the bytes of the document as characters. (Scintilla feature 2137)</summary>
  1304. public int GetCodePage()
  1305. {
  1306. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCODEPAGE, Unused, Unused);
  1307. return (int) res;
  1308. }
  1309. /// <summary>Get the foreground colour of the caret. (Scintilla feature 2138)</summary>
  1310. public Colour GetCaretFore()
  1311. {
  1312. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETFORE, Unused, Unused);
  1313. return new Colour((int) res);
  1314. }
  1315. /// <summary>In read-only mode? (Scintilla feature 2140)</summary>
  1316. public bool GetReadOnly()
  1317. {
  1318. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETREADONLY, Unused, Unused);
  1319. return 1 == (int) res;
  1320. }
  1321. /// <summary>Sets the position of the caret. (Scintilla feature 2141)</summary>
  1322. public void SetCurrentPos(Position pos)
  1323. {
  1324. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCURRENTPOS, pos.Value, Unused);
  1325. }
  1326. /// <summary>Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2142)</summary>
  1327. public void SetSelectionStart(Position pos)
  1328. {
  1329. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONSTART, pos.Value, Unused);
  1330. }
  1331. /// <summary>Returns the position at the start of the selection. (Scintilla feature 2143)</summary>
  1332. public Position GetSelectionStart()
  1333. {
  1334. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONSTART, Unused, Unused);
  1335. return new Position((int) res);
  1336. }
  1337. /// <summary>Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2144)</summary>
  1338. public void SetSelectionEnd(Position pos)
  1339. {
  1340. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONEND, pos.Value, Unused);
  1341. }
  1342. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2145)</summary>
  1343. public Position GetSelectionEnd()
  1344. {
  1345. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEND, Unused, Unused);
  1346. return new Position((int) res);
  1347. }
  1348. /// <summary>Set caret to a position, while removing any existing selection. (Scintilla feature 2556)</summary>
  1349. public void SetEmptySelection(Position pos)
  1350. {
  1351. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEMPTYSELECTION, pos.Value, Unused);
  1352. }
  1353. /// <summary>Sets the print magnification added to the point size of each style for printing. (Scintilla feature 2146)</summary>
  1354. public void SetPrintMagnification(int magnification)
  1355. {
  1356. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTMAGNIFICATION, magnification, Unused);
  1357. }
  1358. /// <summary>Returns the print magnification. (Scintilla feature 2147)</summary>
  1359. public int GetPrintMagnification()
  1360. {
  1361. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTMAGNIFICATION, Unused, Unused);
  1362. return (int) res;
  1363. }
  1364. /// <summary>Modify colours when printing for clearer printed text. (Scintilla feature 2148)</summary>
  1365. public void SetPrintColourMode(int mode)
  1366. {
  1367. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTCOLOURMODE, mode, Unused);
  1368. }
  1369. /// <summary>Returns the print colour mode. (Scintilla feature 2149)</summary>
  1370. public int GetPrintColourMode()
  1371. {
  1372. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTCOLOURMODE, Unused, Unused);
  1373. return (int) res;
  1374. }
  1375. /// <summary>Find some text in the document. (Scintilla feature 2150)</summary>
  1376. public Position FindText(int flags, TextToFind ft)
  1377. {
  1378. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDTEXT, flags, ft.NativePointer);
  1379. return new Position((int) res);
  1380. }
  1381. /// <summary>Retrieve the display line at the top of the display. (Scintilla feature 2152)</summary>
  1382. public int GetFirstVisibleLine()
  1383. {
  1384. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFIRSTVISIBLELINE, Unused, Unused);
  1385. return (int) res;
  1386. }
  1387. /// <summary>
  1388. /// Retrieve the contents of a line.
  1389. /// Returns the length of the line.
  1390. /// (Scintilla feature 2153)
  1391. /// </summary>
  1392. public unsafe string GetLine(int line)
  1393. {
  1394. byte[] textBuffer = new byte[10000];
  1395. fixed (byte* textPtr = textBuffer)
  1396. {
  1397. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINE, line, (IntPtr) textPtr);
  1398. return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0');
  1399. }
  1400. }
  1401. /// <summary>Returns the number of lines in the document. There is always at least one. (Scintilla feature 2154)</summary>
  1402. public int GetLineCount()
  1403. {
  1404. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINECOUNT, Unused, Unused);
  1405. return (int) res;
  1406. }
  1407. /// <summary>Sets the size in pixels of the left margin. (Scintilla feature 2155)</summary>
  1408. public void SetMarginLeft(int pixelWidth)
  1409. {
  1410. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINLEFT, Unused, pixelWidth);
  1411. }
  1412. /// <summary>Returns the size in pixels of the left margin. (Scintilla feature 2156)</summary>
  1413. public int GetMarginLeft()
  1414. {
  1415. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINLEFT, Unused, Unused);
  1416. return (int) res;
  1417. }
  1418. /// <summary>Sets the size in pixels of the right margin. (Scintilla feature 2157)</summary>
  1419. public void SetMarginRight(int pixelWidth)
  1420. {
  1421. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINRIGHT, Unused, pixelWidth);
  1422. }
  1423. /// <summary>Returns the size in pixels of the right margin. (Scintilla feature 2158)</summary>
  1424. public int GetMarginRight()
  1425. {
  1426. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINRIGHT, Unused, Unused);
  1427. return (int) res;
  1428. }
  1429. /// <summary>Is the document different from when it was last saved? (Scintilla feature 2159)</summary>
  1430. public bool GetModify()
  1431. {
  1432. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMODIFY, Unused, Unused);
  1433. return 1 == (int) res;
  1434. }
  1435. /// <summary>Select a range of text. (Scintilla feature 2160)</summary>
  1436. public void SetSel(Position start, Position end)
  1437. {
  1438. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSEL, start.Value, end.Value);
  1439. }
  1440. /// <summary>
  1441. /// Retrieve the selected text.
  1442. /// Return the length of the text.
  1443. /// Result is NUL-terminated.
  1444. /// (Scintilla feature 2161)
  1445. /// </summary>
  1446. public unsafe string GetSelText()
  1447. {
  1448. byte[] textBuffer = new byte[10000];
  1449. fixed (byte* textPtr = textBuffer)
  1450. {
  1451. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELTEXT, Unused, (IntPtr) textPtr);
  1452. return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0');
  1453. }
  1454. }
  1455. /// <summary>
  1456. /// Retrieve a range of text.
  1457. /// Return the length of the text.
  1458. /// (Scintilla feature 2162)
  1459. /// </summary>
  1460. public int GetTextRange(TextRange tr)
  1461. {
  1462. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTRANGE, Unused, tr.NativePointer);
  1463. return (int) res;
  1464. }
  1465. /// <summary>Draw the selection in normal style or with selection highlighted. (Scintilla feature 2163)</summary>
  1466. public void HideSelection(bool normal)
  1467. {
  1468. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HIDESELECTION, normal ? 1 : 0, Unused);
  1469. }
  1470. /// <summary>Retrieve the x value of the point in the window where a position is displayed. (Scintilla feature 2164)</summary>
  1471. public int PointXFromPosition(Position pos)
  1472. {
  1473. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POINTXFROMPOSITION, Unused, pos.Value);
  1474. return (int) res;
  1475. }
  1476. /// <summary>Retrieve the y value of the point in the window where a position is displayed. (Scintilla feature 2165)</summary>
  1477. public int PointYFromPosition(Position pos)
  1478. {
  1479. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POINTYFROMPOSITION, Unused, pos.Value);
  1480. return (int) res;
  1481. }
  1482. /// <summary>Retrieve the line containing a position. (Scintilla feature 2166)</summary>
  1483. public int LineFromPosition(Position pos)
  1484. {
  1485. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEFROMPOSITION, pos.Value, Unused);
  1486. return (int) res;
  1487. }
  1488. /// <summary>Retrieve the position at the start of a line. (Scintilla feature 2167)</summary>
  1489. public Position PositionFromLine(int line)
  1490. {
  1491. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONFROMLINE, line, Unused);
  1492. return new Position((int) res);
  1493. }
  1494. /// <summary>Scroll horizontally and vertically. (Scintilla feature 2168)</summary>
  1495. public void LineScroll(int columns, int lines)
  1496. {
  1497. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLL, columns, lines);
  1498. }
  1499. /// <summary>Ensure the caret is visible. (Scintilla feature 2169)</summary>
  1500. public void ScrollCaret()
  1501. {
  1502. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLCARET, Unused, Unused);
  1503. }
  1504. /// <summary>
  1505. /// Scroll the argument positions and the range between them into view giving
  1506. /// priority to the primary position then the secondary position.
  1507. /// This may be used to make a search match visible.
  1508. /// (Scintilla feature 2569)
  1509. /// </summary>
  1510. public void ScrollRange(Position secondary, Position primary)
  1511. {
  1512. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLRANGE, secondary.Value, primary.Value);
  1513. }
  1514. /// <summary>Replace the selected text with the argument text. (Scintilla feature 2170)</summary>
  1515. public unsafe void ReplaceSel(string text)
  1516. {
  1517. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  1518. {
  1519. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REPLACESEL, Unused, (IntPtr) textPtr);
  1520. }
  1521. }
  1522. /// <summary>Set to read only or read write. (Scintilla feature 2171)</summary>
  1523. public void SetReadOnly(bool readOnly)
  1524. {
  1525. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETREADONLY, readOnly ? 1 : 0, Unused);
  1526. }
  1527. /// <summary>Null operation. (Scintilla feature 2172)</summary>
  1528. public void Null()
  1529. {
  1530. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_NULL, Unused, Unused);
  1531. }
  1532. /// <summary>Will a paste succeed? (Scintilla feature 2173)</summary>
  1533. public bool CanPaste()
  1534. {
  1535. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANPASTE, Unused, Unused);
  1536. return 1 == (int) res;
  1537. }
  1538. /// <summary>Are there any undoable actions in the undo history? (Scintilla feature 2174)</summary>
  1539. public bool CanUndo()
  1540. {
  1541. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANUNDO, Unused, Unused);
  1542. return 1 == (int) res;
  1543. }
  1544. /// <summary>Delete the undo history. (Scintilla feature 2175)</summary>
  1545. public void EmptyUndoBuffer()
  1546. {
  1547. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_EMPTYUNDOBUFFER, Unused, Unused);
  1548. }
  1549. /// <summary>Undo one action in the undo history. (Scintilla feature 2176)</summary>
  1550. public void Undo()
  1551. {
  1552. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_UNDO, Unused, Unused);
  1553. }
  1554. /// <summary>Cut the selection to the clipboard. (Scintilla feature 2177)</summary>
  1555. public void Cut()
  1556. {
  1557. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CUT, Unused, Unused);
  1558. }
  1559. /// <summary>Copy the selection to the clipboard. (Scintilla feature 2178)</summary>
  1560. public void Copy()
  1561. {
  1562. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPY, Unused, Unused);
  1563. }
  1564. /// <summary>Paste the contents of the clipboard into the document replacing the selection. (Scintilla feature 2179)</summary>
  1565. public void Paste()
  1566. {
  1567. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PASTE, Unused, Unused);
  1568. }
  1569. /// <summary>Clear the selection. (Scintilla feature 2180)</summary>
  1570. public void Clear()
  1571. {
  1572. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEAR, Unused, Unused);
  1573. }
  1574. /// <summary>Replace the contents of the document with the argument text. (Scintilla feature 2181)</summary>
  1575. public unsafe void SetText(string text)
  1576. {
  1577. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  1578. {
  1579. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTEXT, Unused, (IntPtr) textPtr);
  1580. }
  1581. }
  1582. /// <summary>
  1583. /// Retrieve all the text in the document.
  1584. /// Returns number of characters retrieved.
  1585. /// Result is NUL-terminated.
  1586. /// (Scintilla feature 2182)
  1587. /// </summary>
  1588. public unsafe string GetText(int length)
  1589. {
  1590. byte[] textBuffer = new byte[length];
  1591. fixed (byte* textPtr = textBuffer)
  1592. {
  1593. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXT, length, (IntPtr) textPtr);
  1594. return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0');
  1595. }
  1596. }
  1597. /// <summary>Retrieve the number of characters in the document. (Scintilla feature 2183)</summary>
  1598. public int GetTextLength()
  1599. {
  1600. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXTLENGTH, Unused, Unused);
  1601. return (int) res;
  1602. }
  1603. /// <summary>Retrieve a pointer to a function that processes messages for this Scintilla. (Scintilla feature 2184)</summary>
  1604. public IntPtr GetDirectFunction()
  1605. {
  1606. return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTFUNCTION, Unused, Unused);
  1607. }
  1608. /// <summary>
  1609. /// Retrieve a pointer value to use as the first argument when calling
  1610. /// the function returned by GetDirectFunction.
  1611. /// (Scintilla feature 2185)
  1612. /// </summary>
  1613. public IntPtr GetDirectPointer()
  1614. {
  1615. return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTPOINTER, Unused, Unused);
  1616. }
  1617. /// <summary>Set to overtype (true) or insert mode. (Scintilla feature 2186)</summary>
  1618. public void SetOvertype(bool overtype)
  1619. {
  1620. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETOVERTYPE, overtype ? 1 : 0, Unused);
  1621. }
  1622. /// <summary>Returns true if overtype mode is active otherwise false is returned. (Scintilla feature 2187)</summary>
  1623. public bool GetOvertype()
  1624. {
  1625. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETOVERTYPE, Unused, Unused);
  1626. return 1 == (int) res;
  1627. }
  1628. /// <summary>Set the width of the insert mode caret. (Scintilla feature 2188)</summary>
  1629. public void SetCaretWidth(int pixelWidth)
  1630. {
  1631. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETWIDTH, pixelWidth, Unused);
  1632. }
  1633. /// <summary>Returns the width of the insert mode caret. (Scintilla feature 2189)</summary>
  1634. public int GetCaretWidth()
  1635. {
  1636. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETWIDTH, Unused, Unused);
  1637. return (int) res;
  1638. }
  1639. /// <summary>
  1640. /// Sets the position that starts the target which is used for updating the
  1641. /// document without affecting the scroll position.
  1642. /// (Scintilla feature 2190)
  1643. /// </summary>
  1644. public void SetTargetStart(Position pos)
  1645. {
  1646. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETSTART, pos.Value, Unused);
  1647. }
  1648. /// <summary>Get the position that starts the target. (Scintilla feature 2191)</summary>
  1649. public Position GetTargetStart()
  1650. {
  1651. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETSTART, Unused, Unused);
  1652. return new Position((int) res);
  1653. }
  1654. /// <summary>
  1655. /// Sets the position that ends the target which is used for updating the
  1656. /// document without affecting the scroll position.
  1657. /// (Scintilla feature 2192)
  1658. /// </summary>
  1659. public void SetTargetEnd(Position pos)
  1660. {
  1661. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETEND, pos.Value, Unused);
  1662. }
  1663. /// <summary>Get the position that ends the target. (Scintilla feature 2193)</summary>
  1664. public Position GetTargetEnd()
  1665. {
  1666. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETEND, Unused, Unused);
  1667. return new Position((int) res);
  1668. }
  1669. /// <summary>Sets both the start and end of the target in one call. (Scintilla feature 2686)</summary>
  1670. public void SetTargetRange(Position start, Position end)
  1671. {
  1672. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTARGETRANGE, start.Value, end.Value);
  1673. }
  1674. /// <summary>Retrieve the text in the target. (Scintilla feature 2687)</summary>
  1675. public unsafe string GetTargetText()
  1676. {
  1677. byte[] charactersBuffer = new byte[10000];
  1678. fixed (byte* charactersPtr = charactersBuffer)
  1679. {
  1680. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTARGETTEXT, Unused, (IntPtr) charactersPtr);
  1681. return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0');
  1682. }
  1683. }
  1684. /// <summary>
  1685. /// Replace the target text with the argument text.
  1686. /// Text is counted so it can contain NULs.
  1687. /// Returns the length of the replacement text.
  1688. /// (Scintilla feature 2194)
  1689. /// </summary>
  1690. public unsafe int ReplaceTarget(int length, string text)
  1691. {
  1692. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  1693. {
  1694. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGET, length, (IntPtr) textPtr);
  1695. return (int) res;
  1696. }
  1697. }
  1698. /// <summary>
  1699. /// Replace the target text with the argument text after \d processing.
  1700. /// Text is counted so it can contain NULs.
  1701. /// Looks for \d where d is between 1 and 9 and replaces these with the strings
  1702. /// matched in the last search operation which were surrounded by \( and \).
  1703. /// Returns the length of the replacement text including any change
  1704. /// caused by processing the \d patterns.
  1705. /// (Scintilla feature 2195)
  1706. /// </summary>
  1707. public unsafe int ReplaceTargetRE(int length, string text)
  1708. {
  1709. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  1710. {
  1711. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REPLACETARGETRE, length, (IntPtr) textPtr);
  1712. return (int) res;
  1713. }
  1714. }
  1715. /// <summary>
  1716. /// Search for a counted string in the target and set the target to the found
  1717. /// range. Text is counted so it can contain NULs.
  1718. /// Returns length of range or -1 for failure in which case target is not moved.
  1719. /// (Scintilla feature 2197)
  1720. /// </summary>
  1721. public unsafe int SearchInTarget(int length, string text)
  1722. {
  1723. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  1724. {
  1725. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHINTARGET, length, (IntPtr) textPtr);
  1726. return (int) res;
  1727. }
  1728. }
  1729. /// <summary>Set the search flags used by SearchInTarget. (Scintilla feature 2198)</summary>
  1730. public void SetSearchFlags(int flags)
  1731. {
  1732. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSEARCHFLAGS, flags, Unused);
  1733. }
  1734. /// <summary>Get the search flags used by SearchInTarget. (Scintilla feature 2199)</summary>
  1735. public int GetSearchFlags()
  1736. {
  1737. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSEARCHFLAGS, Unused, Unused);
  1738. return (int) res;
  1739. }
  1740. /// <summary>Show a call tip containing a definition near position pos. (Scintilla feature 2200)</summary>
  1741. public unsafe void CallTipShow(Position pos, string definition)
  1742. {
  1743. fixed (byte* definitionPtr = Encoding.UTF8.GetBytes(definition))
  1744. {
  1745. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSHOW, pos.Value, (IntPtr) definitionPtr);
  1746. }
  1747. }
  1748. /// <summary>Remove the call tip from the screen. (Scintilla feature 2201)</summary>
  1749. public void CallTipCancel()
  1750. {
  1751. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPCANCEL, Unused, Unused);
  1752. }
  1753. /// <summary>Is there an active call tip? (Scintilla feature 2202)</summary>
  1754. public bool CallTipActive()
  1755. {
  1756. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPACTIVE, Unused, Unused);
  1757. return 1 == (int) res;
  1758. }
  1759. /// <summary>Retrieve the position where the caret was before displaying the call tip. (Scintilla feature 2203)</summary>
  1760. public Position CallTipPosStart()
  1761. {
  1762. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPPOSSTART, Unused, Unused);
  1763. return new Position((int) res);
  1764. }
  1765. /// <summary>Set the start position in order to change when backspacing removes the calltip. (Scintilla feature 2214)</summary>
  1766. public void CallTipSetPosStart(int posStart)
  1767. {
  1768. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSSTART, posStart, Unused);
  1769. }
  1770. /// <summary>Highlight a segment of the definition. (Scintilla feature 2204)</summary>
  1771. public void CallTipSetHlt(int start, int end)
  1772. {
  1773. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETHLT, start, end);
  1774. }
  1775. /// <summary>Set the background colour for the call tip. (Scintilla feature 2205)</summary>
  1776. public void CallTipSetBack(Colour back)
  1777. {
  1778. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETBACK, back.Value, Unused);
  1779. }
  1780. /// <summary>Set the foreground colour for the call tip. (Scintilla feature 2206)</summary>
  1781. public void CallTipSetFore(Colour fore)
  1782. {
  1783. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFORE, fore.Value, Unused);
  1784. }
  1785. /// <summary>Set the foreground colour for the highlighted part of the call tip. (Scintilla feature 2207)</summary>
  1786. public void CallTipSetForeHlt(Colour fore)
  1787. {
  1788. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETFOREHLT, fore.Value, Unused);
  1789. }
  1790. /// <summary>Enable use of STYLE_CALLTIP and set call tip tab size in pixels. (Scintilla feature 2212)</summary>
  1791. public void CallTipUseStyle(int tabSize)
  1792. {
  1793. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPUSESTYLE, tabSize, Unused);
  1794. }
  1795. /// <summary>Set position of calltip, above or below text. (Scintilla feature 2213)</summary>
  1796. public void CallTipSetPosition(bool above)
  1797. {
  1798. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CALLTIPSETPOSITION, above ? 1 : 0, Unused);
  1799. }
  1800. /// <summary>Find the display line of a document line taking hidden lines into account. (Scintilla feature 2220)</summary>
  1801. public int VisibleFromDocLine(int line)
  1802. {
  1803. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VISIBLEFROMDOCLINE, line, Unused);
  1804. return (int) res;
  1805. }
  1806. /// <summary>Find the document line of a display line taking hidden lines into account. (Scintilla feature 2221)</summary>
  1807. public int DocLineFromVisible(int lineDisplay)
  1808. {
  1809. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCLINEFROMVISIBLE, lineDisplay, Unused);
  1810. return (int) res;
  1811. }
  1812. /// <summary>The number of display lines needed to wrap a document line (Scintilla feature 2235)</summary>
  1813. public int WrapCount(int line)
  1814. {
  1815. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WRAPCOUNT, line, Unused);
  1816. return (int) res;
  1817. }
  1818. /// <summary>
  1819. /// Set the fold level of a line.
  1820. /// This encodes an integer level along with flags indicating whether the
  1821. /// line is a header and whether it is effectively white space.
  1822. /// (Scintilla feature 2222)
  1823. /// </summary>
  1824. public void SetFoldLevel(int line, int level)
  1825. {
  1826. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDLEVEL, line, level);
  1827. }
  1828. /// <summary>Retrieve the fold level of a line. (Scintilla feature 2223)</summary>
  1829. public int GetFoldLevel(int line)
  1830. {
  1831. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDLEVEL, line, Unused);
  1832. return (int) res;
  1833. }
  1834. /// <summary>Find the last child line of a header line. (Scintilla feature 2224)</summary>
  1835. public int GetLastChild(int line, int level)
  1836. {
  1837. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLASTCHILD, line, level);
  1838. return (int) res;
  1839. }
  1840. /// <summary>Find the parent line of a child line. (Scintilla feature 2225)</summary>
  1841. public int GetFoldParent(int line)
  1842. {
  1843. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDPARENT, line, Unused);
  1844. return (int) res;
  1845. }
  1846. /// <summary>Make a range of lines visible. (Scintilla feature 2226)</summary>
  1847. public void ShowLines(int lineStart, int lineEnd)
  1848. {
  1849. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SHOWLINES, lineStart, lineEnd);
  1850. }
  1851. /// <summary>Make a range of lines invisible. (Scintilla feature 2227)</summary>
  1852. public void HideLines(int lineStart, int lineEnd)
  1853. {
  1854. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HIDELINES, lineStart, lineEnd);
  1855. }
  1856. /// <summary>Is a line visible? (Scintilla feature 2228)</summary>
  1857. public bool GetLineVisible(int line)
  1858. {
  1859. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEVISIBLE, line, Unused);
  1860. return 1 == (int) res;
  1861. }
  1862. /// <summary>Are all lines visible? (Scintilla feature 2236)</summary>
  1863. public bool GetAllLinesVisible()
  1864. {
  1865. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETALLLINESVISIBLE, Unused, Unused);
  1866. return 1 == (int) res;
  1867. }
  1868. /// <summary>Show the children of a header line. (Scintilla feature 2229)</summary>
  1869. public void SetFoldExpanded(int line, bool expanded)
  1870. {
  1871. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDEXPANDED, line, expanded ? 1 : 0);
  1872. }
  1873. /// <summary>Is a header line expanded? (Scintilla feature 2230)</summary>
  1874. public bool GetFoldExpanded(int line)
  1875. {
  1876. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOLDEXPANDED, line, Unused);
  1877. return 1 == (int) res;
  1878. }
  1879. /// <summary>Switch a header line between expanded and contracted. (Scintilla feature 2231)</summary>
  1880. public void ToggleFold(int line)
  1881. {
  1882. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLEFOLD, line, Unused);
  1883. }
  1884. /// <summary>Expand or contract a fold header. (Scintilla feature 2237)</summary>
  1885. public void FoldLine(int line, int action)
  1886. {
  1887. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FOLDLINE, line, action);
  1888. }
  1889. /// <summary>Expand or contract a fold header and its children. (Scintilla feature 2238)</summary>
  1890. public void FoldChildren(int line, int action)
  1891. {
  1892. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FOLDCHILDREN, line, action);
  1893. }
  1894. /// <summary>Expand a fold header and all children. Use the level argument instead of the line's current level. (Scintilla feature 2239)</summary>
  1895. public void ExpandChildren(int line, int level)
  1896. {
  1897. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_EXPANDCHILDREN, line, level);
  1898. }
  1899. /// <summary>Expand or contract all fold headers. (Scintilla feature 2662)</summary>
  1900. public void FoldAll(int action)
  1901. {
  1902. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FOLDALL, action, Unused);
  1903. }
  1904. /// <summary>Ensure a particular line is visible by expanding any header line hiding it. (Scintilla feature 2232)</summary>
  1905. public void EnsureVisible(int line)
  1906. {
  1907. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLE, line, Unused);
  1908. }
  1909. /// <summary>Set automatic folding behaviours. (Scintilla feature 2663)</summary>
  1910. public void SetAutomaticFold(int automaticFold)
  1911. {
  1912. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETAUTOMATICFOLD, automaticFold, Unused);
  1913. }
  1914. /// <summary>Get automatic folding behaviours. (Scintilla feature 2664)</summary>
  1915. public int GetAutomaticFold()
  1916. {
  1917. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETAUTOMATICFOLD, Unused, Unused);
  1918. return (int) res;
  1919. }
  1920. /// <summary>Set some style options for folding. (Scintilla feature 2233)</summary>
  1921. public void SetFoldFlags(int flags)
  1922. {
  1923. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDFLAGS, flags, Unused);
  1924. }
  1925. /// <summary>
  1926. /// Ensure a particular line is visible by expanding any header line hiding it.
  1927. /// Use the currently set visibility policy to determine which range to display.
  1928. /// (Scintilla feature 2234)
  1929. /// </summary>
  1930. public void EnsureVisibleEnforcePolicy(int line)
  1931. {
  1932. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENSUREVISIBLEENFORCEPOLICY, line, Unused);
  1933. }
  1934. /// <summary>Sets whether a tab pressed when caret is within indentation indents. (Scintilla feature 2260)</summary>
  1935. public void SetTabIndents(bool tabIndents)
  1936. {
  1937. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTABINDENTS, tabIndents ? 1 : 0, Unused);
  1938. }
  1939. /// <summary>Does a tab pressed when caret is within indentation indent? (Scintilla feature 2261)</summary>
  1940. public bool GetTabIndents()
  1941. {
  1942. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTABINDENTS, Unused, Unused);
  1943. return 1 == (int) res;
  1944. }
  1945. /// <summary>Sets whether a backspace pressed when caret is within indentation unindents. (Scintilla feature 2262)</summary>
  1946. public void SetBackSpaceUnIndents(bool bsUnIndents)
  1947. {
  1948. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETBACKSPACEUNINDENTS, bsUnIndents ? 1 : 0, Unused);
  1949. }
  1950. /// <summary>Does a backspace pressed when caret is within indentation unindent? (Scintilla feature 2263)</summary>
  1951. public bool GetBackSpaceUnIndents()
  1952. {
  1953. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETBACKSPACEUNINDENTS, Unused, Unused);
  1954. return 1 == (int) res;
  1955. }
  1956. /// <summary>Sets the time the mouse must sit still to generate a mouse dwell event. (Scintilla feature 2264)</summary>
  1957. public void SetMouseDwellTime(int periodMilliseconds)
  1958. {
  1959. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDWELLTIME, periodMilliseconds, Unused);
  1960. }
  1961. /// <summary>Retrieve the time the mouse must sit still to generate a mouse dwell event. (Scintilla feature 2265)</summary>
  1962. public int GetMouseDwellTime()
  1963. {
  1964. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDWELLTIME, Unused, Unused);
  1965. return (int) res;
  1966. }
  1967. /// <summary>Get position of start of word. (Scintilla feature 2266)</summary>
  1968. public int WordStartPosition(Position pos, bool onlyWordCharacters)
  1969. {
  1970. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDSTARTPOSITION, pos.Value, onlyWordCharacters ? 1 : 0);
  1971. return (int) res;
  1972. }
  1973. /// <summary>Get position of end of word. (Scintilla feature 2267)</summary>
  1974. public int WordEndPosition(Position pos, bool onlyWordCharacters)
  1975. {
  1976. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDENDPOSITION, pos.Value, onlyWordCharacters ? 1 : 0);
  1977. return (int) res;
  1978. }
  1979. /// <summary>Sets whether text is word wrapped. (Scintilla feature 2268)</summary>
  1980. public void SetWrapMode(int mode)
  1981. {
  1982. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPMODE, mode, Unused);
  1983. }
  1984. /// <summary>Retrieve whether text is word wrapped. (Scintilla feature 2269)</summary>
  1985. public int GetWrapMode()
  1986. {
  1987. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPMODE, Unused, Unused);
  1988. return (int) res;
  1989. }
  1990. /// <summary>Set the display mode of visual flags for wrapped lines. (Scintilla feature 2460)</summary>
  1991. public void SetWrapVisualFlags(int wrapVisualFlags)
  1992. {
  1993. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, Unused);
  1994. }
  1995. /// <summary>Retrive the display mode of visual flags for wrapped lines. (Scintilla feature 2461)</summary>
  1996. public int GetWrapVisualFlags()
  1997. {
  1998. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGS, Unused, Unused);
  1999. return (int) res;
  2000. }
  2001. /// <summary>Set the location of visual flags for wrapped lines. (Scintilla feature 2462)</summary>
  2002. public void SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation)
  2003. {
  2004. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, Unused);
  2005. }
  2006. /// <summary>Retrive the location of visual flags for wrapped lines. (Scintilla feature 2463)</summary>
  2007. public int GetWrapVisualFlagsLocation()
  2008. {
  2009. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPVISUALFLAGSLOCATION, Unused, Unused);
  2010. return (int) res;
  2011. }
  2012. /// <summary>Set the start indent for wrapped lines. (Scintilla feature 2464)</summary>
  2013. public void SetWrapStartIndent(int indent)
  2014. {
  2015. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPSTARTINDENT, indent, Unused);
  2016. }
  2017. /// <summary>Retrive the start indent for wrapped lines. (Scintilla feature 2465)</summary>
  2018. public int GetWrapStartIndent()
  2019. {
  2020. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPSTARTINDENT, Unused, Unused);
  2021. return (int) res;
  2022. }
  2023. /// <summary>Sets how wrapped sublines are placed. Default is fixed. (Scintilla feature 2472)</summary>
  2024. public void SetWrapIndentMode(int mode)
  2025. {
  2026. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWRAPINDENTMODE, mode, Unused);
  2027. }
  2028. /// <summary>Retrieve how wrapped sublines are placed. Default is fixed. (Scintilla feature 2473)</summary>
  2029. public int GetWrapIndentMode()
  2030. {
  2031. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWRAPINDENTMODE, Unused, Unused);
  2032. return (int) res;
  2033. }
  2034. /// <summary>Sets the degree of caching of layout information. (Scintilla feature 2272)</summary>
  2035. public void SetLayoutCache(int mode)
  2036. {
  2037. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLAYOUTCACHE, mode, Unused);
  2038. }
  2039. /// <summary>Retrieve the degree of caching of layout information. (Scintilla feature 2273)</summary>
  2040. public int GetLayoutCache()
  2041. {
  2042. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLAYOUTCACHE, Unused, Unused);
  2043. return (int) res;
  2044. }
  2045. /// <summary>Sets the document width assumed for scrolling. (Scintilla feature 2274)</summary>
  2046. public void SetScrollWidth(int pixelWidth)
  2047. {
  2048. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTH, pixelWidth, Unused);
  2049. }
  2050. /// <summary>Retrieve the document width assumed for scrolling. (Scintilla feature 2275)</summary>
  2051. public int GetScrollWidth()
  2052. {
  2053. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTH, Unused, Unused);
  2054. return (int) res;
  2055. }
  2056. /// <summary>Sets whether the maximum width line displayed is used to set scroll width. (Scintilla feature 2516)</summary>
  2057. public void SetScrollWidthTracking(bool tracking)
  2058. {
  2059. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSCROLLWIDTHTRACKING, tracking ? 1 : 0, Unused);
  2060. }
  2061. /// <summary>Retrieve whether the scroll width tracks wide lines. (Scintilla feature 2517)</summary>
  2062. public bool GetScrollWidthTracking()
  2063. {
  2064. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSCROLLWIDTHTRACKING, Unused, Unused);
  2065. return 1 == (int) res;
  2066. }
  2067. /// <summary>
  2068. /// Measure the pixel width of some text in a particular style.
  2069. /// NUL terminated text argument.
  2070. /// Does not handle tab or control characters.
  2071. /// (Scintilla feature 2276)
  2072. /// </summary>
  2073. public unsafe int TextWidth(int style, string text)
  2074. {
  2075. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  2076. {
  2077. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TEXTWIDTH, style, (IntPtr) textPtr);
  2078. return (int) res;
  2079. }
  2080. }
  2081. /// <summary>
  2082. /// Sets the scroll range so that maximum scroll position has
  2083. /// the last line at the bottom of the view (default).
  2084. /// Setting this to false allows scrolling one page below the last line.
  2085. /// (Scintilla feature 2277)
  2086. /// </summary>
  2087. public void SetEndAtLastLine(bool endAtLastLine)
  2088. {
  2089. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETENDATLASTLINE, endAtLastLine ? 1 : 0, Unused);
  2090. }
  2091. /// <summary>
  2092. /// Retrieve whether the maximum scroll position has the last
  2093. /// line at the bottom of the view.
  2094. /// (Scintilla feature 2278)
  2095. /// </summary>
  2096. public bool GetEndAtLastLine()
  2097. {
  2098. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETENDATLASTLINE, Unused, Unused);
  2099. return 1 == (int) res;
  2100. }
  2101. /// <summary>Retrieve the height of a particular line of text in pixels. (Scintilla feature 2279)</summary>
  2102. public int TextHeight(int line)
  2103. {
  2104. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TEXTHEIGHT, line, Unused);
  2105. return (int) res;
  2106. }
  2107. /// <summary>Show or hide the vertical scroll bar. (Scintilla feature 2280)</summary>
  2108. public void SetVScrollBar(bool show)
  2109. {
  2110. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVSCROLLBAR, show ? 1 : 0, Unused);
  2111. }
  2112. /// <summary>Is the vertical scroll bar visible? (Scintilla feature 2281)</summary>
  2113. public bool GetVScrollBar()
  2114. {
  2115. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVSCROLLBAR, Unused, Unused);
  2116. return 1 == (int) res;
  2117. }
  2118. /// <summary>Append a string to the end of the document without changing the selection. (Scintilla feature 2282)</summary>
  2119. public unsafe void AppendText(int length, string text)
  2120. {
  2121. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  2122. {
  2123. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_APPENDTEXT, length, (IntPtr) textPtr);
  2124. }
  2125. }
  2126. /// <summary>Is drawing done in two phases with backgrounds drawn before foregrounds? (Scintilla feature 2283)</summary>
  2127. public bool GetTwoPhaseDraw()
  2128. {
  2129. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTWOPHASEDRAW, Unused, Unused);
  2130. return 1 == (int) res;
  2131. }
  2132. /// <summary>
  2133. /// In twoPhaseDraw mode, drawing is performed in two phases, first the background
  2134. /// and then the foreground. This avoids chopping off characters that overlap the next run.
  2135. /// (Scintilla feature 2284)
  2136. /// </summary>
  2137. public void SetTwoPhaseDraw(bool twoPhase)
  2138. {
  2139. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTWOPHASEDRAW, twoPhase ? 1 : 0, Unused);
  2140. }
  2141. /// <summary>How many phases is drawing done in? (Scintilla feature 2673)</summary>
  2142. public int GetPhasesDraw()
  2143. {
  2144. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPHASESDRAW, Unused, Unused);
  2145. return (int) res;
  2146. }
  2147. /// <summary>
  2148. /// In one phase draw, text is drawn in a series of rectangular blocks with no overlap.
  2149. /// In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally.
  2150. /// In multiple phase draw, each element is drawn over the whole drawing area, allowing text
  2151. /// to overlap from one line to the next.
  2152. /// (Scintilla feature 2674)
  2153. /// </summary>
  2154. public void SetPhasesDraw(int phases)
  2155. {
  2156. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPHASESDRAW, phases, Unused);
  2157. }
  2158. /// <summary>Choose the quality level for text from the FontQuality enumeration. (Scintilla feature 2611)</summary>
  2159. public void SetFontQuality(int fontQuality)
  2160. {
  2161. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFONTQUALITY, fontQuality, Unused);
  2162. }
  2163. /// <summary>Retrieve the quality level for text. (Scintilla feature 2612)</summary>
  2164. public int GetFontQuality()
  2165. {
  2166. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFONTQUALITY, Unused, Unused);
  2167. return (int) res;
  2168. }
  2169. /// <summary>Scroll so that a display line is at the top of the display. (Scintilla feature 2613)</summary>
  2170. public void SetFirstVisibleLine(int lineDisplay)
  2171. {
  2172. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFIRSTVISIBLELINE, lineDisplay, Unused);
  2173. }
  2174. /// <summary>Change the effect of pasting when there are multiple selections. (Scintilla feature 2614)</summary>
  2175. public void SetMultiPaste(int multiPaste)
  2176. {
  2177. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPASTE, multiPaste, Unused);
  2178. }
  2179. /// <summary>Retrieve the effect of pasting when there are multiple selections.. (Scintilla feature 2615)</summary>
  2180. public int GetMultiPaste()
  2181. {
  2182. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPASTE, Unused, Unused);
  2183. return (int) res;
  2184. }
  2185. /// <summary>
  2186. /// Retrieve the value of a tag from a regular expression search.
  2187. /// Result is NUL-terminated.
  2188. /// (Scintilla feature 2616)
  2189. /// </summary>
  2190. public unsafe string GetTag(int tagNumber)
  2191. {
  2192. byte[] tagValueBuffer = new byte[10000];
  2193. fixed (byte* tagValuePtr = tagValueBuffer)
  2194. {
  2195. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTAG, tagNumber, (IntPtr) tagValuePtr);
  2196. return Encoding.UTF8.GetString(tagValueBuffer).TrimEnd('\0');
  2197. }
  2198. }
  2199. /// <summary>Make the target range start and end be the same as the selection range start and end. (Scintilla feature 2287)</summary>
  2200. public void TargetFromSelection()
  2201. {
  2202. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TARGETFROMSELECTION, Unused, Unused);
  2203. }
  2204. /// <summary>Join the lines in the target. (Scintilla feature 2288)</summary>
  2205. public void LinesJoin()
  2206. {
  2207. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESJOIN, Unused, Unused);
  2208. }
  2209. /// <summary>
  2210. /// Split the lines in the target into lines that are less wide than pixelWidth
  2211. /// where possible.
  2212. /// (Scintilla feature 2289)
  2213. /// </summary>
  2214. public void LinesSplit(int pixelWidth)
  2215. {
  2216. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESSPLIT, pixelWidth, Unused);
  2217. }
  2218. /// <summary>Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2290)</summary>
  2219. public void SetFoldMarginColour(bool useSetting, Colour back)
  2220. {
  2221. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINCOLOUR, useSetting ? 1 : 0, back.Value);
  2222. }
  2223. /// <summary>Set the colours used as a chequerboard pattern in the fold margin (Scintilla feature 2291)</summary>
  2224. public void SetFoldMarginHiColour(bool useSetting, Colour fore)
  2225. {
  2226. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOLDMARGINHICOLOUR, useSetting ? 1 : 0, fore.Value);
  2227. }
  2228. /// <summary>Move caret down one line. (Scintilla feature 2300)</summary>
  2229. public void LineDown()
  2230. {
  2231. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWN, Unused, Unused);
  2232. }
  2233. /// <summary>Move caret down one line extending selection to new caret position. (Scintilla feature 2301)</summary>
  2234. public void LineDownExtend()
  2235. {
  2236. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNEXTEND, Unused, Unused);
  2237. }
  2238. /// <summary>Move caret up one line. (Scintilla feature 2302)</summary>
  2239. public void LineUp()
  2240. {
  2241. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEUP, Unused, Unused);
  2242. }
  2243. /// <summary>Move caret up one line extending selection to new caret position. (Scintilla feature 2303)</summary>
  2244. public void LineUpExtend()
  2245. {
  2246. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPEXTEND, Unused, Unused);
  2247. }
  2248. /// <summary>Move caret left one character. (Scintilla feature 2304)</summary>
  2249. public void CharLeft()
  2250. {
  2251. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFT, Unused, Unused);
  2252. }
  2253. /// <summary>Move caret left one character extending selection to new caret position. (Scintilla feature 2305)</summary>
  2254. public void CharLeftExtend()
  2255. {
  2256. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTEXTEND, Unused, Unused);
  2257. }
  2258. /// <summary>Move caret right one character. (Scintilla feature 2306)</summary>
  2259. public void CharRight()
  2260. {
  2261. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHT, Unused, Unused);
  2262. }
  2263. /// <summary>Move caret right one character extending selection to new caret position. (Scintilla feature 2307)</summary>
  2264. public void CharRightExtend()
  2265. {
  2266. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTEXTEND, Unused, Unused);
  2267. }
  2268. /// <summary>Move caret left one word. (Scintilla feature 2308)</summary>
  2269. public void WordLeft()
  2270. {
  2271. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFT, Unused, Unused);
  2272. }
  2273. /// <summary>Move caret left one word extending selection to new caret position. (Scintilla feature 2309)</summary>
  2274. public void WordLeftExtend()
  2275. {
  2276. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEXTEND, Unused, Unused);
  2277. }
  2278. /// <summary>Move caret right one word. (Scintilla feature 2310)</summary>
  2279. public void WordRight()
  2280. {
  2281. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHT, Unused, Unused);
  2282. }
  2283. /// <summary>Move caret right one word extending selection to new caret position. (Scintilla feature 2311)</summary>
  2284. public void WordRightExtend()
  2285. {
  2286. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEXTEND, Unused, Unused);
  2287. }
  2288. /// <summary>Move caret to first position on line. (Scintilla feature 2312)</summary>
  2289. public void Home()
  2290. {
  2291. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOME, Unused, Unused);
  2292. }
  2293. /// <summary>Move caret to first position on line extending selection to new caret position. (Scintilla feature 2313)</summary>
  2294. public void HomeExtend()
  2295. {
  2296. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEEXTEND, Unused, Unused);
  2297. }
  2298. /// <summary>Move caret to last position on line. (Scintilla feature 2314)</summary>
  2299. public void LineEnd()
  2300. {
  2301. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEEND, Unused, Unused);
  2302. }
  2303. /// <summary>Move caret to last position on line extending selection to new caret position. (Scintilla feature 2315)</summary>
  2304. public void LineEndExtend()
  2305. {
  2306. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDEXTEND, Unused, Unused);
  2307. }
  2308. /// <summary>Move caret to first position in document. (Scintilla feature 2316)</summary>
  2309. public void DocumentStart()
  2310. {
  2311. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTART, Unused, Unused);
  2312. }
  2313. /// <summary>Move caret to first position in document extending selection to new caret position. (Scintilla feature 2317)</summary>
  2314. public void DocumentStartExtend()
  2315. {
  2316. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTSTARTEXTEND, Unused, Unused);
  2317. }
  2318. /// <summary>Move caret to last position in document. (Scintilla feature 2318)</summary>
  2319. public void DocumentEnd()
  2320. {
  2321. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTEND, Unused, Unused);
  2322. }
  2323. /// <summary>Move caret to last position in document extending selection to new caret position. (Scintilla feature 2319)</summary>
  2324. public void DocumentEndExtend()
  2325. {
  2326. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DOCUMENTENDEXTEND, Unused, Unused);
  2327. }
  2328. /// <summary>Move caret one page up. (Scintilla feature 2320)</summary>
  2329. public void PageUp()
  2330. {
  2331. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUP, Unused, Unused);
  2332. }
  2333. /// <summary>Move caret one page up extending selection to new caret position. (Scintilla feature 2321)</summary>
  2334. public void PageUpExtend()
  2335. {
  2336. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPEXTEND, Unused, Unused);
  2337. }
  2338. /// <summary>Move caret one page down. (Scintilla feature 2322)</summary>
  2339. public void PageDown()
  2340. {
  2341. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWN, Unused, Unused);
  2342. }
  2343. /// <summary>Move caret one page down extending selection to new caret position. (Scintilla feature 2323)</summary>
  2344. public void PageDownExtend()
  2345. {
  2346. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNEXTEND, Unused, Unused);
  2347. }
  2348. /// <summary>Switch from insert to overtype mode or the reverse. (Scintilla feature 2324)</summary>
  2349. public void EditToggleOvertype()
  2350. {
  2351. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_EDITTOGGLEOVERTYPE, Unused, Unused);
  2352. }
  2353. /// <summary>Cancel any modes such as call tip or auto-completion list display. (Scintilla feature 2325)</summary>
  2354. public void Cancel()
  2355. {
  2356. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CANCEL, Unused, Unused);
  2357. }
  2358. /// <summary>Delete the selection or if no selection, the character before the caret. (Scintilla feature 2326)</summary>
  2359. public void DeleteBack()
  2360. {
  2361. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACK, Unused, Unused);
  2362. }
  2363. /// <summary>
  2364. /// If selection is empty or all on one line replace the selection with a tab character.
  2365. /// If more than one line selected, indent the lines.
  2366. /// (Scintilla feature 2327)
  2367. /// </summary>
  2368. public void Tab()
  2369. {
  2370. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TAB, Unused, Unused);
  2371. }
  2372. /// <summary>Dedent the selected lines. (Scintilla feature 2328)</summary>
  2373. public void BackTab()
  2374. {
  2375. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BACKTAB, Unused, Unused);
  2376. }
  2377. /// <summary>Insert a new line, may use a CRLF, CR or LF depending on EOL mode. (Scintilla feature 2329)</summary>
  2378. public void NewLine()
  2379. {
  2380. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_NEWLINE, Unused, Unused);
  2381. }
  2382. /// <summary>Insert a Form Feed character. (Scintilla feature 2330)</summary>
  2383. public void FormFeed()
  2384. {
  2385. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FORMFEED, Unused, Unused);
  2386. }
  2387. /// <summary>
  2388. /// Move caret to before first visible character on line.
  2389. /// If already there move to first character on line.
  2390. /// (Scintilla feature 2331)
  2391. /// </summary>
  2392. public void VCHome()
  2393. {
  2394. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOME, Unused, Unused);
  2395. }
  2396. /// <summary>Like VCHome but extending selection to new caret position. (Scintilla feature 2332)</summary>
  2397. public void VCHomeExtend()
  2398. {
  2399. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEEXTEND, Unused, Unused);
  2400. }
  2401. /// <summary>Magnify the displayed text by increasing the sizes by 1 point. (Scintilla feature 2333)</summary>
  2402. public void ZoomIn()
  2403. {
  2404. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMIN, Unused, Unused);
  2405. }
  2406. /// <summary>Make the displayed text smaller by decreasing the sizes by 1 point. (Scintilla feature 2334)</summary>
  2407. public void ZoomOut()
  2408. {
  2409. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ZOOMOUT, Unused, Unused);
  2410. }
  2411. /// <summary>Delete the word to the left of the caret. (Scintilla feature 2335)</summary>
  2412. public void DelWordLeft()
  2413. {
  2414. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDLEFT, Unused, Unused);
  2415. }
  2416. /// <summary>Delete the word to the right of the caret. (Scintilla feature 2336)</summary>
  2417. public void DelWordRight()
  2418. {
  2419. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHT, Unused, Unused);
  2420. }
  2421. /// <summary>Delete the word to the right of the caret, but not the trailing non-word characters. (Scintilla feature 2518)</summary>
  2422. public void DelWordRightEnd()
  2423. {
  2424. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELWORDRIGHTEND, Unused, Unused);
  2425. }
  2426. /// <summary>Cut the line containing the caret. (Scintilla feature 2337)</summary>
  2427. public void LineCut()
  2428. {
  2429. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINECUT, Unused, Unused);
  2430. }
  2431. /// <summary>Delete the line containing the caret. (Scintilla feature 2338)</summary>
  2432. public void LineDelete()
  2433. {
  2434. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDELETE, Unused, Unused);
  2435. }
  2436. /// <summary>Switch the current line with the previous. (Scintilla feature 2339)</summary>
  2437. public void LineTranspose()
  2438. {
  2439. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINETRANSPOSE, Unused, Unused);
  2440. }
  2441. /// <summary>Duplicate the current line. (Scintilla feature 2404)</summary>
  2442. public void LineDuplicate()
  2443. {
  2444. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDUPLICATE, Unused, Unused);
  2445. }
  2446. /// <summary>Transform the selection to lower case. (Scintilla feature 2340)</summary>
  2447. public void LowerCase()
  2448. {
  2449. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LOWERCASE, Unused, Unused);
  2450. }
  2451. /// <summary>Transform the selection to upper case. (Scintilla feature 2341)</summary>
  2452. public void UpperCase()
  2453. {
  2454. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_UPPERCASE, Unused, Unused);
  2455. }
  2456. /// <summary>Scroll the document down, keeping the caret visible. (Scintilla feature 2342)</summary>
  2457. public void LineScrollDown()
  2458. {
  2459. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLDOWN, Unused, Unused);
  2460. }
  2461. /// <summary>Scroll the document up, keeping the caret visible. (Scintilla feature 2343)</summary>
  2462. public void LineScrollUp()
  2463. {
  2464. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESCROLLUP, Unused, Unused);
  2465. }
  2466. /// <summary>
  2467. /// Delete the selection or if no selection, the character before the caret.
  2468. /// Will not delete the character before at the start of a line.
  2469. /// (Scintilla feature 2344)
  2470. /// </summary>
  2471. public void DeleteBackNotLine()
  2472. {
  2473. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELETEBACKNOTLINE, Unused, Unused);
  2474. }
  2475. /// <summary>Move caret to first position on display line. (Scintilla feature 2345)</summary>
  2476. public void HomeDisplay()
  2477. {
  2478. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAY, Unused, Unused);
  2479. }
  2480. /// <summary>
  2481. /// Move caret to first position on display line extending selection to
  2482. /// new caret position.
  2483. /// (Scintilla feature 2346)
  2484. /// </summary>
  2485. public void HomeDisplayExtend()
  2486. {
  2487. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEDISPLAYEXTEND, Unused, Unused);
  2488. }
  2489. /// <summary>Move caret to last position on display line. (Scintilla feature 2347)</summary>
  2490. public void LineEndDisplay()
  2491. {
  2492. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAY, Unused, Unused);
  2493. }
  2494. /// <summary>
  2495. /// Move caret to last position on display line extending selection to new
  2496. /// caret position.
  2497. /// (Scintilla feature 2348)
  2498. /// </summary>
  2499. public void LineEndDisplayExtend()
  2500. {
  2501. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDDISPLAYEXTEND, Unused, Unused);
  2502. }
  2503. /// <summary>
  2504. /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
  2505. /// except they behave differently when word-wrap is enabled:
  2506. /// They go first to the start / end of the display line, like (Home|LineEnd)Display
  2507. /// The difference is that, the cursor is already at the point, it goes on to the start
  2508. /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
  2509. /// (Scintilla feature 2349)
  2510. /// </summary>
  2511. public void HomeWrap()
  2512. {
  2513. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAP, Unused, Unused);
  2514. }
  2515. /// <summary>
  2516. /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
  2517. /// except they behave differently when word-wrap is enabled:
  2518. /// They go first to the start / end of the display line, like (Home|LineEnd)Display
  2519. /// The difference is that, the cursor is already at the point, it goes on to the start
  2520. /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
  2521. /// (Scintilla feature 2450)
  2522. /// </summary>
  2523. public void HomeWrapExtend()
  2524. {
  2525. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMEWRAPEXTEND, Unused, Unused);
  2526. }
  2527. /// <summary>
  2528. /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
  2529. /// except they behave differently when word-wrap is enabled:
  2530. /// They go first to the start / end of the display line, like (Home|LineEnd)Display
  2531. /// The difference is that, the cursor is already at the point, it goes on to the start
  2532. /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
  2533. /// (Scintilla feature 2451)
  2534. /// </summary>
  2535. public void LineEndWrap()
  2536. {
  2537. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAP, Unused, Unused);
  2538. }
  2539. /// <summary>
  2540. /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
  2541. /// except they behave differently when word-wrap is enabled:
  2542. /// They go first to the start / end of the display line, like (Home|LineEnd)Display
  2543. /// The difference is that, the cursor is already at the point, it goes on to the start
  2544. /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
  2545. /// (Scintilla feature 2452)
  2546. /// </summary>
  2547. public void LineEndWrapExtend()
  2548. {
  2549. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDWRAPEXTEND, Unused, Unused);
  2550. }
  2551. /// <summary>
  2552. /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
  2553. /// except they behave differently when word-wrap is enabled:
  2554. /// They go first to the start / end of the display line, like (Home|LineEnd)Display
  2555. /// The difference is that, the cursor is already at the point, it goes on to the start
  2556. /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
  2557. /// (Scintilla feature 2453)
  2558. /// </summary>
  2559. public void VCHomeWrap()
  2560. {
  2561. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAP, Unused, Unused);
  2562. }
  2563. /// <summary>
  2564. /// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
  2565. /// except they behave differently when word-wrap is enabled:
  2566. /// They go first to the start / end of the display line, like (Home|LineEnd)Display
  2567. /// The difference is that, the cursor is already at the point, it goes on to the start
  2568. /// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
  2569. /// (Scintilla feature 2454)
  2570. /// </summary>
  2571. public void VCHomeWrapExtend()
  2572. {
  2573. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEWRAPEXTEND, Unused, Unused);
  2574. }
  2575. /// <summary>Copy the line containing the caret. (Scintilla feature 2455)</summary>
  2576. public void LineCopy()
  2577. {
  2578. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINECOPY, Unused, Unused);
  2579. }
  2580. /// <summary>Move the caret inside current view if it's not there already. (Scintilla feature 2401)</summary>
  2581. public void MoveCaretInsideView()
  2582. {
  2583. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MOVECARETINSIDEVIEW, Unused, Unused);
  2584. }
  2585. /// <summary>How many characters are on a line, including end of line characters? (Scintilla feature 2350)</summary>
  2586. public int LineLength(int line)
  2587. {
  2588. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINELENGTH, line, Unused);
  2589. return (int) res;
  2590. }
  2591. /// <summary>Highlight the characters at two positions. (Scintilla feature 2351)</summary>
  2592. public void BraceHighlight(Position pos1, Position pos2)
  2593. {
  2594. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHT, pos1.Value, pos2.Value);
  2595. }
  2596. /// <summary>Use specified indicator to highlight matching braces instead of changing their style. (Scintilla feature 2498)</summary>
  2597. public void BraceHighlightIndicator(bool useBraceHighlightIndicator, int indicator)
  2598. {
  2599. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEHIGHLIGHTINDICATOR, useBraceHighlightIndicator ? 1 : 0, indicator);
  2600. }
  2601. /// <summary>Highlight the character at a position indicating there is no matching brace. (Scintilla feature 2352)</summary>
  2602. public void BraceBadLight(Position pos)
  2603. {
  2604. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHT, pos.Value, Unused);
  2605. }
  2606. /// <summary>Use specified indicator to highlight non matching brace instead of changing its style. (Scintilla feature 2499)</summary>
  2607. public void BraceBadLightIndicator(bool useBraceBadLightIndicator, int indicator)
  2608. {
  2609. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEBADLIGHTINDICATOR, useBraceBadLightIndicator ? 1 : 0, indicator);
  2610. }
  2611. /// <summary>Find the position of a matching brace or INVALID_POSITION if no match. (Scintilla feature 2353)</summary>
  2612. public Position BraceMatch(Position pos)
  2613. {
  2614. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_BRACEMATCH, pos.Value, Unused);
  2615. return new Position((int) res);
  2616. }
  2617. /// <summary>Are the end of line characters visible? (Scintilla feature 2355)</summary>
  2618. public bool GetViewEOL()
  2619. {
  2620. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVIEWEOL, Unused, Unused);
  2621. return 1 == (int) res;
  2622. }
  2623. /// <summary>Make the end of line characters visible or invisible. (Scintilla feature 2356)</summary>
  2624. public void SetViewEOL(bool visible)
  2625. {
  2626. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVIEWEOL, visible ? 1 : 0, Unused);
  2627. }
  2628. /// <summary>Retrieve a pointer to the document object. (Scintilla feature 2357)</summary>
  2629. public IntPtr GetDocPointer()
  2630. {
  2631. return Win32.SendMessage(scintilla, SciMsg.SCI_GETDOCPOINTER, Unused, Unused);
  2632. }
  2633. /// <summary>Change the document object used. (Scintilla feature 2358)</summary>
  2634. public void SetDocPointer(IntPtr pointer)
  2635. {
  2636. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETDOCPOINTER, Unused, pointer);
  2637. }
  2638. /// <summary>Set which document modification events are sent to the container. (Scintilla feature 2359)</summary>
  2639. public void SetModEventMask(int mask)
  2640. {
  2641. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMODEVENTMASK, mask, Unused);
  2642. }
  2643. /// <summary>Retrieve the column number which text should be kept within. (Scintilla feature 2360)</summary>
  2644. public int GetEdgeColumn()
  2645. {
  2646. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLUMN, Unused, Unused);
  2647. return (int) res;
  2648. }
  2649. /// <summary>
  2650. /// Set the column number of the edge.
  2651. /// If text goes past the edge then it is highlighted.
  2652. /// (Scintilla feature 2361)
  2653. /// </summary>
  2654. public void SetEdgeColumn(int column)
  2655. {
  2656. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLUMN, column, Unused);
  2657. }
  2658. /// <summary>Retrieve the edge highlight mode. (Scintilla feature 2362)</summary>
  2659. public int GetEdgeMode()
  2660. {
  2661. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGEMODE, Unused, Unused);
  2662. return (int) res;
  2663. }
  2664. /// <summary>
  2665. /// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
  2666. /// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
  2667. /// (Scintilla feature 2363)
  2668. /// </summary>
  2669. public void SetEdgeMode(int mode)
  2670. {
  2671. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGEMODE, mode, Unused);
  2672. }
  2673. /// <summary>Retrieve the colour used in edge indication. (Scintilla feature 2364)</summary>
  2674. public Colour GetEdgeColour()
  2675. {
  2676. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEDGECOLOUR, Unused, Unused);
  2677. return new Colour((int) res);
  2678. }
  2679. /// <summary>Change the colour used in edge indication. (Scintilla feature 2365)</summary>
  2680. public void SetEdgeColour(Colour edgeColour)
  2681. {
  2682. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEDGECOLOUR, edgeColour.Value, Unused);
  2683. }
  2684. /// <summary>Sets the current caret position to be the search anchor. (Scintilla feature 2366)</summary>
  2685. public void SearchAnchor()
  2686. {
  2687. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHANCHOR, Unused, Unused);
  2688. }
  2689. /// <summary>
  2690. /// Find some text starting at the search anchor.
  2691. /// Does not ensure the selection is visible.
  2692. /// (Scintilla feature 2367)
  2693. /// </summary>
  2694. public unsafe int SearchNext(int flags, string text)
  2695. {
  2696. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  2697. {
  2698. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHNEXT, flags, (IntPtr) textPtr);
  2699. return (int) res;
  2700. }
  2701. }
  2702. /// <summary>
  2703. /// Find some text starting at the search anchor and moving backwards.
  2704. /// Does not ensure the selection is visible.
  2705. /// (Scintilla feature 2368)
  2706. /// </summary>
  2707. public unsafe int SearchPrev(int flags, string text)
  2708. {
  2709. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  2710. {
  2711. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SEARCHPREV, flags, (IntPtr) textPtr);
  2712. return (int) res;
  2713. }
  2714. }
  2715. /// <summary>Retrieves the number of lines completely visible. (Scintilla feature 2370)</summary>
  2716. public int LinesOnScreen()
  2717. {
  2718. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINESONSCREEN, Unused, Unused);
  2719. return (int) res;
  2720. }
  2721. /// <summary>
  2722. /// Set whether a pop up menu is displayed automatically when the user presses
  2723. /// the wrong mouse button.
  2724. /// (Scintilla feature 2371)
  2725. /// </summary>
  2726. public void UsePopUp(bool allowPopUp)
  2727. {
  2728. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_USEPOPUP, allowPopUp ? 1 : 0, Unused);
  2729. }
  2730. /// <summary>Is the selection rectangular? The alternative is the more common stream selection. (Scintilla feature 2372)</summary>
  2731. public bool SelectionIsRectangle()
  2732. {
  2733. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONISRECTANGLE, Unused, Unused);
  2734. return 1 == (int) res;
  2735. }
  2736. /// <summary>
  2737. /// Set the zoom level. This number of points is added to the size of all fonts.
  2738. /// It may be positive to magnify or negative to reduce.
  2739. /// (Scintilla feature 2373)
  2740. /// </summary>
  2741. public void SetZoom(int zoom)
  2742. {
  2743. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETZOOM, zoom, Unused);
  2744. }
  2745. /// <summary>Retrieve the zoom level. (Scintilla feature 2374)</summary>
  2746. public int GetZoom()
  2747. {
  2748. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETZOOM, Unused, Unused);
  2749. return (int) res;
  2750. }
  2751. /// <summary>
  2752. /// Create a new document object.
  2753. /// Starts with reference count of 1 and not selected into editor.
  2754. /// (Scintilla feature 2375)
  2755. /// </summary>
  2756. public int CreateDocument()
  2757. {
  2758. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CREATEDOCUMENT, Unused, Unused);
  2759. return (int) res;
  2760. }
  2761. /// <summary>Extend life of document. (Scintilla feature 2376)</summary>
  2762. public void AddRefDocument(int doc)
  2763. {
  2764. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDREFDOCUMENT, Unused, doc);
  2765. }
  2766. /// <summary>Release a reference to the document, deleting document if it fades to black. (Scintilla feature 2377)</summary>
  2767. public void ReleaseDocument(int doc)
  2768. {
  2769. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEDOCUMENT, Unused, doc);
  2770. }
  2771. /// <summary>Get which document modification events are sent to the container. (Scintilla feature 2378)</summary>
  2772. public int GetModEventMask()
  2773. {
  2774. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMODEVENTMASK, Unused, Unused);
  2775. return (int) res;
  2776. }
  2777. /// <summary>Change internal focus flag. (Scintilla feature 2380)</summary>
  2778. public void SetFocus(bool focus)
  2779. {
  2780. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETFOCUS, focus ? 1 : 0, Unused);
  2781. }
  2782. /// <summary>Get internal focus flag. (Scintilla feature 2381)</summary>
  2783. public bool GetFocus()
  2784. {
  2785. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETFOCUS, Unused, Unused);
  2786. return 1 == (int) res;
  2787. }
  2788. /// <summary>Change error status - 0 = OK. (Scintilla feature 2382)</summary>
  2789. public void SetStatus(int statusCode)
  2790. {
  2791. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSTATUS, statusCode, Unused);
  2792. }
  2793. /// <summary>Get error status. (Scintilla feature 2383)</summary>
  2794. public int GetStatus()
  2795. {
  2796. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTATUS, Unused, Unused);
  2797. return (int) res;
  2798. }
  2799. /// <summary>Set whether the mouse is captured when its button is pressed. (Scintilla feature 2384)</summary>
  2800. public void SetMouseDownCaptures(bool captures)
  2801. {
  2802. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSEDOWNCAPTURES, captures ? 1 : 0, Unused);
  2803. }
  2804. /// <summary>Get whether mouse gets captured. (Scintilla feature 2385)</summary>
  2805. public bool GetMouseDownCaptures()
  2806. {
  2807. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSEDOWNCAPTURES, Unused, Unused);
  2808. return 1 == (int) res;
  2809. }
  2810. /// <summary>Sets the cursor to one of the SC_CURSOR* values. (Scintilla feature 2386)</summary>
  2811. public void SetCursor(int cursorType)
  2812. {
  2813. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCURSOR, cursorType, Unused);
  2814. }
  2815. /// <summary>Get cursor type. (Scintilla feature 2387)</summary>
  2816. public int GetCursor()
  2817. {
  2818. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCURSOR, Unused, Unused);
  2819. return (int) res;
  2820. }
  2821. /// <summary>
  2822. /// Change the way control characters are displayed:
  2823. /// If symbol is < 32, keep the drawn way, else, use the given character.
  2824. /// (Scintilla feature 2388)
  2825. /// </summary>
  2826. public void SetControlCharSymbol(int symbol)
  2827. {
  2828. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCONTROLCHARSYMBOL, symbol, Unused);
  2829. }
  2830. /// <summary>Get the way control characters are displayed. (Scintilla feature 2389)</summary>
  2831. public int GetControlCharSymbol()
  2832. {
  2833. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCONTROLCHARSYMBOL, Unused, Unused);
  2834. return (int) res;
  2835. }
  2836. /// <summary>Move to the previous change in capitalisation. (Scintilla feature 2390)</summary>
  2837. public void WordPartLeft()
  2838. {
  2839. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFT, Unused, Unused);
  2840. }
  2841. /// <summary>
  2842. /// Move to the previous change in capitalisation extending selection
  2843. /// to new caret position.
  2844. /// (Scintilla feature 2391)
  2845. /// </summary>
  2846. public void WordPartLeftExtend()
  2847. {
  2848. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTLEFTEXTEND, Unused, Unused);
  2849. }
  2850. /// <summary>Move to the change next in capitalisation. (Scintilla feature 2392)</summary>
  2851. public void WordPartRight()
  2852. {
  2853. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHT, Unused, Unused);
  2854. }
  2855. /// <summary>
  2856. /// Move to the next change in capitalisation extending selection
  2857. /// to new caret position.
  2858. /// (Scintilla feature 2393)
  2859. /// </summary>
  2860. public void WordPartRightExtend()
  2861. {
  2862. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDPARTRIGHTEXTEND, Unused, Unused);
  2863. }
  2864. /// <summary>
  2865. /// Set the way the display area is determined when a particular line
  2866. /// is to be moved to by Find, FindNext, GotoLine, etc.
  2867. /// (Scintilla feature 2394)
  2868. /// </summary>
  2869. public void SetVisiblePolicy(int visiblePolicy, int visibleSlop)
  2870. {
  2871. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVISIBLEPOLICY, visiblePolicy, visibleSlop);
  2872. }
  2873. /// <summary>Delete back from the current position to the start of the line. (Scintilla feature 2395)</summary>
  2874. public void DelLineLeft()
  2875. {
  2876. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELLINELEFT, Unused, Unused);
  2877. }
  2878. /// <summary>Delete forwards from the current position to the end of the line. (Scintilla feature 2396)</summary>
  2879. public void DelLineRight()
  2880. {
  2881. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DELLINERIGHT, Unused, Unused);
  2882. }
  2883. /// <summary>Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2397)</summary>
  2884. public void SetXOffset(int newOffset)
  2885. {
  2886. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETXOFFSET, newOffset, Unused);
  2887. }
  2888. /// <summary>Get and Set the xOffset (ie, horizontal scroll position). (Scintilla feature 2398)</summary>
  2889. public int GetXOffset()
  2890. {
  2891. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETXOFFSET, Unused, Unused);
  2892. return (int) res;
  2893. }
  2894. /// <summary>Set the last x chosen value to be the caret x position. (Scintilla feature 2399)</summary>
  2895. public void ChooseCaretX()
  2896. {
  2897. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHOOSECARETX, Unused, Unused);
  2898. }
  2899. /// <summary>Set the focus to this Scintilla widget. (Scintilla feature 2400)</summary>
  2900. public void GrabFocus()
  2901. {
  2902. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GRABFOCUS, Unused, Unused);
  2903. }
  2904. /// <summary>
  2905. /// Set the way the caret is kept visible when going sideways.
  2906. /// The exclusion zone is given in pixels.
  2907. /// (Scintilla feature 2402)
  2908. /// </summary>
  2909. public void SetXCaretPolicy(int caretPolicy, int caretSlop)
  2910. {
  2911. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETXCARETPOLICY, caretPolicy, caretSlop);
  2912. }
  2913. /// <summary>
  2914. /// Set the way the line the caret is on is kept visible.
  2915. /// The exclusion zone is given in lines.
  2916. /// (Scintilla feature 2403)
  2917. /// </summary>
  2918. public void SetYCaretPolicy(int caretPolicy, int caretSlop)
  2919. {
  2920. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETYCARETPOLICY, caretPolicy, caretSlop);
  2921. }
  2922. /// <summary>Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). (Scintilla feature 2406)</summary>
  2923. public void SetPrintWrapMode(int mode)
  2924. {
  2925. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPRINTWRAPMODE, mode, Unused);
  2926. }
  2927. /// <summary>Is printing line wrapped? (Scintilla feature 2407)</summary>
  2928. public int GetPrintWrapMode()
  2929. {
  2930. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRINTWRAPMODE, Unused, Unused);
  2931. return (int) res;
  2932. }
  2933. /// <summary>Set a fore colour for active hotspots. (Scintilla feature 2410)</summary>
  2934. public void SetHotspotActiveFore(bool useSetting, Colour fore)
  2935. {
  2936. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEFORE, useSetting ? 1 : 0, fore.Value);
  2937. }
  2938. /// <summary>Get the fore colour for active hotspots. (Scintilla feature 2494)</summary>
  2939. public Colour GetHotspotActiveFore()
  2940. {
  2941. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEFORE, Unused, Unused);
  2942. return new Colour((int) res);
  2943. }
  2944. /// <summary>Set a back colour for active hotspots. (Scintilla feature 2411)</summary>
  2945. public void SetHotspotActiveBack(bool useSetting, Colour back)
  2946. {
  2947. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEBACK, useSetting ? 1 : 0, back.Value);
  2948. }
  2949. /// <summary>Get the back colour for active hotspots. (Scintilla feature 2495)</summary>
  2950. public Colour GetHotspotActiveBack()
  2951. {
  2952. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEBACK, Unused, Unused);
  2953. return new Colour((int) res);
  2954. }
  2955. /// <summary>Enable / Disable underlining active hotspots. (Scintilla feature 2412)</summary>
  2956. public void SetHotspotActiveUnderline(bool underline)
  2957. {
  2958. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTACTIVEUNDERLINE, underline ? 1 : 0, Unused);
  2959. }
  2960. /// <summary>Get whether underlining for active hotspots. (Scintilla feature 2496)</summary>
  2961. public bool GetHotspotActiveUnderline()
  2962. {
  2963. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTACTIVEUNDERLINE, Unused, Unused);
  2964. return 1 == (int) res;
  2965. }
  2966. /// <summary>Limit hotspots to single line so hotspots on two lines don't merge. (Scintilla feature 2421)</summary>
  2967. public void SetHotspotSingleLine(bool singleLine)
  2968. {
  2969. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETHOTSPOTSINGLELINE, singleLine ? 1 : 0, Unused);
  2970. }
  2971. /// <summary>Get the HotspotSingleLine property (Scintilla feature 2497)</summary>
  2972. public bool GetHotspotSingleLine()
  2973. {
  2974. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETHOTSPOTSINGLELINE, Unused, Unused);
  2975. return 1 == (int) res;
  2976. }
  2977. /// <summary>Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2413)</summary>
  2978. public void ParaDown()
  2979. {
  2980. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWN, Unused, Unused);
  2981. }
  2982. /// <summary>Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2414)</summary>
  2983. public void ParaDownExtend()
  2984. {
  2985. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARADOWNEXTEND, Unused, Unused);
  2986. }
  2987. /// <summary>Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2415)</summary>
  2988. public void ParaUp()
  2989. {
  2990. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARAUP, Unused, Unused);
  2991. }
  2992. /// <summary>Move caret between paragraphs (delimited by empty lines). (Scintilla feature 2416)</summary>
  2993. public void ParaUpExtend()
  2994. {
  2995. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PARAUPEXTEND, Unused, Unused);
  2996. }
  2997. /// <summary>
  2998. /// Given a valid document position, return the previous position taking code
  2999. /// page into account. Returns 0 if passed 0.
  3000. /// (Scintilla feature 2417)
  3001. /// </summary>
  3002. public Position PositionBefore(Position pos)
  3003. {
  3004. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONBEFORE, pos.Value, Unused);
  3005. return new Position((int) res);
  3006. }
  3007. /// <summary>
  3008. /// Given a valid document position, return the next position taking code
  3009. /// page into account. Maximum value returned is the last position in the document.
  3010. /// (Scintilla feature 2418)
  3011. /// </summary>
  3012. public Position PositionAfter(Position pos)
  3013. {
  3014. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONAFTER, pos.Value, Unused);
  3015. return new Position((int) res);
  3016. }
  3017. /// <summary>
  3018. /// Given a valid document position, return a position that differs in a number
  3019. /// of characters. Returned value is always between 0 and last position in document.
  3020. /// (Scintilla feature 2670)
  3021. /// </summary>
  3022. public Position PositionRelative(Position pos, int relative)
  3023. {
  3024. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_POSITIONRELATIVE, pos.Value, relative);
  3025. return new Position((int) res);
  3026. }
  3027. /// <summary>Copy a range of text to the clipboard. Positions are clipped into the document. (Scintilla feature 2419)</summary>
  3028. public void CopyRange(Position start, Position end)
  3029. {
  3030. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPYRANGE, start.Value, end.Value);
  3031. }
  3032. /// <summary>Copy argument text to the clipboard. (Scintilla feature 2420)</summary>
  3033. public unsafe void CopyText(int length, string text)
  3034. {
  3035. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  3036. {
  3037. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPYTEXT, length, (IntPtr) textPtr);
  3038. }
  3039. }
  3040. /// <summary>
  3041. /// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
  3042. /// by lines (SC_SEL_LINES).
  3043. /// (Scintilla feature 2422)
  3044. /// </summary>
  3045. public void SetSelectionMode(int mode)
  3046. {
  3047. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONMODE, mode, Unused);
  3048. }
  3049. /// <summary>Get the mode of the current selection. (Scintilla feature 2423)</summary>
  3050. public int GetSelectionMode()
  3051. {
  3052. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONMODE, Unused, Unused);
  3053. return (int) res;
  3054. }
  3055. /// <summary>Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2424)</summary>
  3056. public Position GetLineSelStartPosition(int line)
  3057. {
  3058. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELSTARTPOSITION, line, Unused);
  3059. return new Position((int) res);
  3060. }
  3061. /// <summary>Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). (Scintilla feature 2425)</summary>
  3062. public Position GetLineSelEndPosition(int line)
  3063. {
  3064. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINESELENDPOSITION, line, Unused);
  3065. return new Position((int) res);
  3066. }
  3067. /// <summary>Move caret down one line, extending rectangular selection to new caret position. (Scintilla feature 2426)</summary>
  3068. public void LineDownRectExtend()
  3069. {
  3070. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEDOWNRECTEXTEND, Unused, Unused);
  3071. }
  3072. /// <summary>Move caret up one line, extending rectangular selection to new caret position. (Scintilla feature 2427)</summary>
  3073. public void LineUpRectExtend()
  3074. {
  3075. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEUPRECTEXTEND, Unused, Unused);
  3076. }
  3077. /// <summary>Move caret left one character, extending rectangular selection to new caret position. (Scintilla feature 2428)</summary>
  3078. public void CharLeftRectExtend()
  3079. {
  3080. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARLEFTRECTEXTEND, Unused, Unused);
  3081. }
  3082. /// <summary>Move caret right one character, extending rectangular selection to new caret position. (Scintilla feature 2429)</summary>
  3083. public void CharRightRectExtend()
  3084. {
  3085. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARRIGHTRECTEXTEND, Unused, Unused);
  3086. }
  3087. /// <summary>Move caret to first position on line, extending rectangular selection to new caret position. (Scintilla feature 2430)</summary>
  3088. public void HomeRectExtend()
  3089. {
  3090. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_HOMERECTEXTEND, Unused, Unused);
  3091. }
  3092. /// <summary>
  3093. /// Move caret to before first visible character on line.
  3094. /// If already there move to first character on line.
  3095. /// In either case, extend rectangular selection to new caret position.
  3096. /// (Scintilla feature 2431)
  3097. /// </summary>
  3098. public void VCHomeRectExtend()
  3099. {
  3100. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMERECTEXTEND, Unused, Unused);
  3101. }
  3102. /// <summary>Move caret to last position on line, extending rectangular selection to new caret position. (Scintilla feature 2432)</summary>
  3103. public void LineEndRectExtend()
  3104. {
  3105. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LINEENDRECTEXTEND, Unused, Unused);
  3106. }
  3107. /// <summary>Move caret one page up, extending rectangular selection to new caret position. (Scintilla feature 2433)</summary>
  3108. public void PageUpRectExtend()
  3109. {
  3110. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEUPRECTEXTEND, Unused, Unused);
  3111. }
  3112. /// <summary>Move caret one page down, extending rectangular selection to new caret position. (Scintilla feature 2434)</summary>
  3113. public void PageDownRectExtend()
  3114. {
  3115. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PAGEDOWNRECTEXTEND, Unused, Unused);
  3116. }
  3117. /// <summary>Move caret to top of page, or one page up if already at top of page. (Scintilla feature 2435)</summary>
  3118. public void StutteredPageUp()
  3119. {
  3120. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUP, Unused, Unused);
  3121. }
  3122. /// <summary>Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. (Scintilla feature 2436)</summary>
  3123. public void StutteredPageUpExtend()
  3124. {
  3125. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEUPEXTEND, Unused, Unused);
  3126. }
  3127. /// <summary>Move caret to bottom of page, or one page down if already at bottom of page. (Scintilla feature 2437)</summary>
  3128. public void StutteredPageDown()
  3129. {
  3130. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWN, Unused, Unused);
  3131. }
  3132. /// <summary>Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. (Scintilla feature 2438)</summary>
  3133. public void StutteredPageDownExtend()
  3134. {
  3135. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STUTTEREDPAGEDOWNEXTEND, Unused, Unused);
  3136. }
  3137. /// <summary>Move caret left one word, position cursor at end of word. (Scintilla feature 2439)</summary>
  3138. public void WordLeftEnd()
  3139. {
  3140. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTEND, Unused, Unused);
  3141. }
  3142. /// <summary>Move caret left one word, position cursor at end of word, extending selection to new caret position. (Scintilla feature 2440)</summary>
  3143. public void WordLeftEndExtend()
  3144. {
  3145. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDLEFTENDEXTEND, Unused, Unused);
  3146. }
  3147. /// <summary>Move caret right one word, position cursor at end of word. (Scintilla feature 2441)</summary>
  3148. public void WordRightEnd()
  3149. {
  3150. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTEND, Unused, Unused);
  3151. }
  3152. /// <summary>Move caret right one word, position cursor at end of word, extending selection to new caret position. (Scintilla feature 2442)</summary>
  3153. public void WordRightEndExtend()
  3154. {
  3155. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_WORDRIGHTENDEXTEND, Unused, Unused);
  3156. }
  3157. /// <summary>
  3158. /// Set the set of characters making up whitespace for when moving or selecting by word.
  3159. /// Should be called after SetWordChars.
  3160. /// (Scintilla feature 2443)
  3161. /// </summary>
  3162. public unsafe void SetWhitespaceChars(string characters)
  3163. {
  3164. fixed (byte* charactersPtr = Encoding.UTF8.GetBytes(characters))
  3165. {
  3166. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETWHITESPACECHARS, Unused, (IntPtr) charactersPtr);
  3167. }
  3168. }
  3169. /// <summary>Get the set of characters making up whitespace for when moving or selecting by word. (Scintilla feature 2647)</summary>
  3170. public unsafe string GetWhitespaceChars()
  3171. {
  3172. byte[] charactersBuffer = new byte[10000];
  3173. fixed (byte* charactersPtr = charactersBuffer)
  3174. {
  3175. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETWHITESPACECHARS, Unused, (IntPtr) charactersPtr);
  3176. return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0');
  3177. }
  3178. }
  3179. /// <summary>
  3180. /// Set the set of characters making up punctuation characters
  3181. /// Should be called after SetWordChars.
  3182. /// (Scintilla feature 2648)
  3183. /// </summary>
  3184. public unsafe void SetPunctuationChars(string characters)
  3185. {
  3186. fixed (byte* charactersPtr = Encoding.UTF8.GetBytes(characters))
  3187. {
  3188. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPUNCTUATIONCHARS, Unused, (IntPtr) charactersPtr);
  3189. }
  3190. }
  3191. /// <summary>Get the set of characters making up punctuation characters (Scintilla feature 2649)</summary>
  3192. public unsafe string GetPunctuationChars()
  3193. {
  3194. byte[] charactersBuffer = new byte[10000];
  3195. fixed (byte* charactersPtr = charactersBuffer)
  3196. {
  3197. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPUNCTUATIONCHARS, Unused, (IntPtr) charactersPtr);
  3198. return Encoding.UTF8.GetString(charactersBuffer).TrimEnd('\0');
  3199. }
  3200. }
  3201. /// <summary>Reset the set of characters for whitespace and word characters to the defaults. (Scintilla feature 2444)</summary>
  3202. public void SetCharsDefault()
  3203. {
  3204. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCHARSDEFAULT, Unused, Unused);
  3205. }
  3206. /// <summary>Get currently selected item position in the auto-completion list (Scintilla feature 2445)</summary>
  3207. public int AutoCGetCurrent()
  3208. {
  3209. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCURRENT, Unused, Unused);
  3210. return (int) res;
  3211. }
  3212. /// <summary>
  3213. /// Get currently selected item text in the auto-completion list
  3214. /// Returns the length of the item text
  3215. /// Result is NUL-terminated.
  3216. /// (Scintilla feature 2610)
  3217. /// </summary>
  3218. public unsafe string AutoCGetCurrentText()
  3219. {
  3220. byte[] sBuffer = new byte[10000];
  3221. fixed (byte* sPtr = sBuffer)
  3222. {
  3223. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCURRENTTEXT, Unused, (IntPtr) sPtr);
  3224. return Encoding.UTF8.GetString(sBuffer).TrimEnd('\0');
  3225. }
  3226. }
  3227. /// <summary>Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. (Scintilla feature 2634)</summary>
  3228. public void AutoCSetCaseInsensitiveBehaviour(int behaviour)
  3229. {
  3230. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, behaviour, Unused);
  3231. }
  3232. /// <summary>Get auto-completion case insensitive behaviour. (Scintilla feature 2635)</summary>
  3233. public int AutoCGetCaseInsensitiveBehaviour()
  3234. {
  3235. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR, Unused, Unused);
  3236. return (int) res;
  3237. }
  3238. /// <summary>Change the effect of autocompleting when there are multiple selections. (Scintilla feature 2636)</summary>
  3239. public void AutoCSetMulti(int multi)
  3240. {
  3241. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETMULTI, multi, Unused);
  3242. }
  3243. /// <summary>Retrieve the effect of autocompleting when there are multiple selections.. (Scintilla feature 2637)</summary>
  3244. public int AutoCGetMulti()
  3245. {
  3246. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETMULTI, Unused, Unused);
  3247. return (int) res;
  3248. }
  3249. /// <summary>Set the way autocompletion lists are ordered. (Scintilla feature 2660)</summary>
  3250. public void AutoCSetOrder(int order)
  3251. {
  3252. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCSETORDER, order, Unused);
  3253. }
  3254. /// <summary>Get the way autocompletion lists are ordered. (Scintilla feature 2661)</summary>
  3255. public int AutoCGetOrder()
  3256. {
  3257. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_AUTOCGETORDER, Unused, Unused);
  3258. return (int) res;
  3259. }
  3260. /// <summary>Enlarge the document to a particular size of text bytes. (Scintilla feature 2446)</summary>
  3261. public void Allocate(int bytes)
  3262. {
  3263. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATE, bytes, Unused);
  3264. }
  3265. /// <summary>
  3266. /// Returns the target converted to UTF8.
  3267. /// Return the length in bytes.
  3268. /// (Scintilla feature 2447)
  3269. /// </summary>
  3270. public unsafe string TargetAsUTF8()
  3271. {
  3272. byte[] sBuffer = new byte[10000];
  3273. fixed (byte* sPtr = sBuffer)
  3274. {
  3275. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TARGETASUTF8, Unused, (IntPtr) sPtr);
  3276. return Encoding.UTF8.GetString(sBuffer).TrimEnd('\0');
  3277. }
  3278. }
  3279. /// <summary>
  3280. /// Set the length of the utf8 argument for calling EncodedFromUTF8.
  3281. /// Set to -1 and the string will be measured to the first nul.
  3282. /// (Scintilla feature 2448)
  3283. /// </summary>
  3284. public void SetLengthForEncode(int bytes)
  3285. {
  3286. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLENGTHFORENCODE, bytes, Unused);
  3287. }
  3288. /// <summary>
  3289. /// Translates a UTF8 string into the document encoding.
  3290. /// Return the length of the result in bytes.
  3291. /// On error return 0.
  3292. /// (Scintilla feature 2449)
  3293. /// </summary>
  3294. public unsafe string EncodedFromUTF8(string utf8)
  3295. {
  3296. fixed (byte* utf8Ptr = Encoding.UTF8.GetBytes(utf8))
  3297. {
  3298. byte[] encodedBuffer = new byte[10000];
  3299. fixed (byte* encodedPtr = encodedBuffer)
  3300. {
  3301. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ENCODEDFROMUTF8, (IntPtr) utf8Ptr, (IntPtr) encodedPtr);
  3302. return Encoding.UTF8.GetString(encodedBuffer).TrimEnd('\0');
  3303. }
  3304. }
  3305. }
  3306. /// <summary>
  3307. /// Translates a UTF8 string into the document encoding.
  3308. /// Return the length of the result in bytes.
  3309. /// On error return 0.
  3310. /// (Scintilla feature 2449)
  3311. /// </summary>
  3312. public unsafe int EncodedFromUTF8Len(string utf8)
  3313. {
  3314. fixed (byte* utf8Ptr = Encoding.UTF8.GetBytes(utf8))
  3315. {
  3316. byte[] encodedBuffer = new byte[10000];
  3317. fixed (byte* encodedPtr = encodedBuffer)
  3318. {
  3319. var res = Win32.SendMessage(scintilla, SciMsg.SCI_ENCODEDFROMUTF8, (IntPtr)utf8Ptr, (IntPtr)encodedPtr);
  3320. return res.ToInt32();
  3321. }
  3322. }
  3323. }
  3324. /// <summary>
  3325. /// Find the position of a column on a line taking into account tabs and
  3326. /// multi-byte characters. If beyond end of line, return line end position.
  3327. /// (Scintilla feature 2456)
  3328. /// </summary>
  3329. public int FindColumn(int line, int column)
  3330. {
  3331. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDCOLUMN, line, column);
  3332. return (int) res;
  3333. }
  3334. /// <summary>Can the caret preferred x position only be changed by explicit movement commands? (Scintilla feature 2457)</summary>
  3335. public int GetCaretSticky()
  3336. {
  3337. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTICKY, Unused, Unused);
  3338. return (int) res;
  3339. }
  3340. /// <summary>Stop the caret preferred x position changing when the user types. (Scintilla feature 2458)</summary>
  3341. public void SetCaretSticky(int useCaretStickyBehaviour)
  3342. {
  3343. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTICKY, useCaretStickyBehaviour, Unused);
  3344. }
  3345. /// <summary>Switch between sticky and non-sticky: meant to be bound to a key. (Scintilla feature 2459)</summary>
  3346. public void ToggleCaretSticky()
  3347. {
  3348. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_TOGGLECARETSTICKY, Unused, Unused);
  3349. }
  3350. /// <summary>Enable/Disable convert-on-paste for line endings (Scintilla feature 2467)</summary>
  3351. public void SetPasteConvertEndings(bool convert)
  3352. {
  3353. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPASTECONVERTENDINGS, convert ? 1 : 0, Unused);
  3354. }
  3355. /// <summary>Get convert-on-paste setting (Scintilla feature 2468)</summary>
  3356. public bool GetPasteConvertEndings()
  3357. {
  3358. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPASTECONVERTENDINGS, Unused, Unused);
  3359. return 1 == (int) res;
  3360. }
  3361. /// <summary>Duplicate the selection. If selection empty duplicate the line containing the caret. (Scintilla feature 2469)</summary>
  3362. public void SelectionDuplicate()
  3363. {
  3364. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SELECTIONDUPLICATE, Unused, Unused);
  3365. }
  3366. /// <summary>Set background alpha of the caret line. (Scintilla feature 2470)</summary>
  3367. public void SetCaretLineBackAlpha(int alpha)
  3368. {
  3369. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACKALPHA, alpha, Unused);
  3370. }
  3371. /// <summary>Get the background alpha of the caret line. (Scintilla feature 2471)</summary>
  3372. public int GetCaretLineBackAlpha()
  3373. {
  3374. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEBACKALPHA, Unused, Unused);
  3375. return (int) res;
  3376. }
  3377. /// <summary>Set the style of the caret to be drawn. (Scintilla feature 2512)</summary>
  3378. public void SetCaretStyle(int caretStyle)
  3379. {
  3380. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETSTYLE, caretStyle, Unused);
  3381. }
  3382. /// <summary>Returns the current style of the caret. (Scintilla feature 2513)</summary>
  3383. public int GetCaretStyle()
  3384. {
  3385. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETSTYLE, Unused, Unused);
  3386. return (int) res;
  3387. }
  3388. /// <summary>Set the indicator used for IndicatorFillRange and IndicatorClearRange (Scintilla feature 2500)</summary>
  3389. public void SetIndicatorCurrent(int indicator)
  3390. {
  3391. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORCURRENT, indicator, Unused);
  3392. }
  3393. /// <summary>Get the current indicator (Scintilla feature 2501)</summary>
  3394. public int GetIndicatorCurrent()
  3395. {
  3396. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORCURRENT, Unused, Unused);
  3397. return (int) res;
  3398. }
  3399. /// <summary>Set the value used for IndicatorFillRange (Scintilla feature 2502)</summary>
  3400. public void SetIndicatorValue(int value)
  3401. {
  3402. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETINDICATORVALUE, value, Unused);
  3403. }
  3404. /// <summary>Get the current indicator value (Scintilla feature 2503)</summary>
  3405. public int GetIndicatorValue()
  3406. {
  3407. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETINDICATORVALUE, Unused, Unused);
  3408. return (int) res;
  3409. }
  3410. /// <summary>Turn a indicator on over a range. (Scintilla feature 2504)</summary>
  3411. public void IndicatorFillRange(int position, int fillLength)
  3412. {
  3413. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORFILLRANGE, position, fillLength);
  3414. }
  3415. /// <summary>Turn a indicator off over a range. (Scintilla feature 2505)</summary>
  3416. public void IndicatorClearRange(int position, int clearLength)
  3417. {
  3418. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORCLEARRANGE, position, clearLength);
  3419. }
  3420. /// <summary>Are any indicators present at position? (Scintilla feature 2506)</summary>
  3421. public int IndicatorAllOnFor(int position)
  3422. {
  3423. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORALLONFOR, position, Unused);
  3424. return (int) res;
  3425. }
  3426. /// <summary>What value does a particular indicator have at at a position? (Scintilla feature 2507)</summary>
  3427. public int IndicatorValueAt(int indicator, int position)
  3428. {
  3429. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORVALUEAT, indicator, position);
  3430. return (int) res;
  3431. }
  3432. /// <summary>Where does a particular indicator start? (Scintilla feature 2508)</summary>
  3433. public int IndicatorStart(int indicator, int position)
  3434. {
  3435. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATORSTART, indicator, position);
  3436. return (int) res;
  3437. }
  3438. /// <summary>Where does a particular indicator end? (Scintilla feature 2509)</summary>
  3439. public int IndicatorEnd(int indicator, int position)
  3440. {
  3441. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICATOREND, indicator, position);
  3442. return (int) res;
  3443. }
  3444. /// <summary>Set number of entries in position cache (Scintilla feature 2514)</summary>
  3445. public void SetPositionCache(int size)
  3446. {
  3447. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPOSITIONCACHE, size, Unused);
  3448. }
  3449. /// <summary>How many entries are allocated to the position cache? (Scintilla feature 2515)</summary>
  3450. public int GetPositionCache()
  3451. {
  3452. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPOSITIONCACHE, Unused, Unused);
  3453. return (int) res;
  3454. }
  3455. /// <summary>Copy the selection, if selection empty copy the line with the caret (Scintilla feature 2519)</summary>
  3456. public void CopyAllowLine()
  3457. {
  3458. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COPYALLOWLINE, Unused, Unused);
  3459. }
  3460. /// <summary>
  3461. /// Compact the document buffer and return a read-only pointer to the
  3462. /// characters in the document.
  3463. /// (Scintilla feature 2520)
  3464. /// </summary>
  3465. public IntPtr GetCharacterPointer()
  3466. {
  3467. return Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARACTERPOINTER, Unused, Unused);
  3468. }
  3469. /// <summary>
  3470. /// Return a read-only pointer to a range of characters in the document.
  3471. /// May move the gap so that the range is contiguous, but will only move up
  3472. /// to rangeLength bytes.
  3473. /// (Scintilla feature 2643)
  3474. /// </summary>
  3475. public IntPtr GetRangePointer(int position, int rangeLength)
  3476. {
  3477. return Win32.SendMessage(scintilla, SciMsg.SCI_GETRANGEPOINTER, position, rangeLength);
  3478. }
  3479. /// <summary>
  3480. /// Return a position which, to avoid performance costs, should not be within
  3481. /// the range of a call to GetRangePointer.
  3482. /// (Scintilla feature 2644)
  3483. /// </summary>
  3484. public Position GetGapPosition()
  3485. {
  3486. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETGAPPOSITION, Unused, Unused);
  3487. return new Position((int) res);
  3488. }
  3489. /// <summary>Set the alpha fill colour of the given indicator. (Scintilla feature 2523)</summary>
  3490. public void IndicSetAlpha(int indicator, int alpha)
  3491. {
  3492. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETALPHA, indicator, alpha);
  3493. }
  3494. /// <summary>Get the alpha fill colour of the given indicator. (Scintilla feature 2524)</summary>
  3495. public int IndicGetAlpha(int indicator)
  3496. {
  3497. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETALPHA, indicator, Unused);
  3498. return (int) res;
  3499. }
  3500. /// <summary>Set the alpha outline colour of the given indicator. (Scintilla feature 2558)</summary>
  3501. public void IndicSetOutlineAlpha(int indicator, int alpha)
  3502. {
  3503. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICSETOUTLINEALPHA, indicator, alpha);
  3504. }
  3505. /// <summary>Get the alpha outline colour of the given indicator. (Scintilla feature 2559)</summary>
  3506. public int IndicGetOutlineAlpha(int indicator)
  3507. {
  3508. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_INDICGETOUTLINEALPHA, indicator, Unused);
  3509. return (int) res;
  3510. }
  3511. /// <summary>Set extra ascent for each line (Scintilla feature 2525)</summary>
  3512. public void SetExtraAscent(int extraAscent)
  3513. {
  3514. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRAASCENT, extraAscent, Unused);
  3515. }
  3516. /// <summary>Get extra ascent for each line (Scintilla feature 2526)</summary>
  3517. public int GetExtraAscent()
  3518. {
  3519. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRAASCENT, Unused, Unused);
  3520. return (int) res;
  3521. }
  3522. /// <summary>Set extra descent for each line (Scintilla feature 2527)</summary>
  3523. public void SetExtraDescent(int extraDescent)
  3524. {
  3525. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETEXTRADESCENT, extraDescent, Unused);
  3526. }
  3527. /// <summary>Get extra descent for each line (Scintilla feature 2528)</summary>
  3528. public int GetExtraDescent()
  3529. {
  3530. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETEXTRADESCENT, Unused, Unused);
  3531. return (int) res;
  3532. }
  3533. /// <summary>Which symbol was defined for markerNumber with MarkerDefine (Scintilla feature 2529)</summary>
  3534. public int MarkerSymbolDefined(int markerNumber)
  3535. {
  3536. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERSYMBOLDEFINED, markerNumber, Unused);
  3537. return (int) res;
  3538. }
  3539. /// <summary>Set the text in the text margin for a line (Scintilla feature 2530)</summary>
  3540. public unsafe void MarginSetText(int line, string text)
  3541. {
  3542. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  3543. {
  3544. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETTEXT, line, (IntPtr) textPtr);
  3545. }
  3546. }
  3547. /// <summary>Get the text in the text margin for a line (Scintilla feature 2531)</summary>
  3548. public unsafe string MarginGetText(int line)
  3549. {
  3550. byte[] textBuffer = new byte[10000];
  3551. fixed (byte* textPtr = textBuffer)
  3552. {
  3553. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETTEXT, line, (IntPtr) textPtr);
  3554. return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0');
  3555. }
  3556. }
  3557. /// <summary>Set the style number for the text margin for a line (Scintilla feature 2532)</summary>
  3558. public void MarginSetStyle(int line, int style)
  3559. {
  3560. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLE, line, style);
  3561. }
  3562. /// <summary>Get the style number for the text margin for a line (Scintilla feature 2533)</summary>
  3563. public int MarginGetStyle(int line)
  3564. {
  3565. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLE, line, Unused);
  3566. return (int) res;
  3567. }
  3568. /// <summary>Set the style in the text margin for a line (Scintilla feature 2534)</summary>
  3569. public unsafe void MarginSetStyles(int line, string styles)
  3570. {
  3571. fixed (byte* stylesPtr = Encoding.UTF8.GetBytes(styles))
  3572. {
  3573. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLES, line, (IntPtr) stylesPtr);
  3574. }
  3575. }
  3576. /// <summary>Get the styles in the text margin for a line (Scintilla feature 2535)</summary>
  3577. public unsafe string MarginGetStyles(int line)
  3578. {
  3579. byte[] stylesBuffer = new byte[10000];
  3580. fixed (byte* stylesPtr = stylesBuffer)
  3581. {
  3582. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLES, line, (IntPtr) stylesPtr);
  3583. return Encoding.UTF8.GetString(stylesBuffer).TrimEnd('\0');
  3584. }
  3585. }
  3586. /// <summary>Clear the margin text on all lines (Scintilla feature 2536)</summary>
  3587. public void MarginTextClearAll()
  3588. {
  3589. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINTEXTCLEARALL, Unused, Unused);
  3590. }
  3591. /// <summary>Get the start of the range of style numbers used for margin text (Scintilla feature 2537)</summary>
  3592. public void MarginSetStyleOffset(int style)
  3593. {
  3594. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINSETSTYLEOFFSET, style, Unused);
  3595. }
  3596. /// <summary>Get the start of the range of style numbers used for margin text (Scintilla feature 2538)</summary>
  3597. public int MarginGetStyleOffset()
  3598. {
  3599. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARGINGETSTYLEOFFSET, Unused, Unused);
  3600. return (int) res;
  3601. }
  3602. /// <summary>Set the margin options. (Scintilla feature 2539)</summary>
  3603. public void SetMarginOptions(int marginOptions)
  3604. {
  3605. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMARGINOPTIONS, marginOptions, Unused);
  3606. }
  3607. /// <summary>Get the margin options. (Scintilla feature 2557)</summary>
  3608. public int GetMarginOptions()
  3609. {
  3610. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMARGINOPTIONS, Unused, Unused);
  3611. return (int) res;
  3612. }
  3613. /// <summary>Set the annotation text for a line (Scintilla feature 2540)</summary>
  3614. public unsafe void AnnotationSetText(int line, string text)
  3615. {
  3616. fixed (byte* textPtr = Encoding.UTF8.GetBytes(text))
  3617. {
  3618. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETTEXT, line, (IntPtr) textPtr);
  3619. }
  3620. }
  3621. /// <summary>Get the annotation text for a line (Scintilla feature 2541)</summary>
  3622. public unsafe string AnnotationGetText(int line)
  3623. {
  3624. byte[] textBuffer = new byte[10000];
  3625. fixed (byte* textPtr = textBuffer)
  3626. {
  3627. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETTEXT, line, (IntPtr) textPtr);
  3628. return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0');
  3629. }
  3630. }
  3631. /// <summary>Set the style number for the annotations for a line (Scintilla feature 2542)</summary>
  3632. public void AnnotationSetStyle(int line, int style)
  3633. {
  3634. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLE, line, style);
  3635. }
  3636. /// <summary>Get the style number for the annotations for a line (Scintilla feature 2543)</summary>
  3637. public int AnnotationGetStyle(int line)
  3638. {
  3639. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLE, line, Unused);
  3640. return (int) res;
  3641. }
  3642. /// <summary>Set the annotation styles for a line (Scintilla feature 2544)</summary>
  3643. public unsafe void AnnotationSetStyles(int line, string styles)
  3644. {
  3645. fixed (byte* stylesPtr = Encoding.UTF8.GetBytes(styles))
  3646. {
  3647. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLES, line, (IntPtr) stylesPtr);
  3648. }
  3649. }
  3650. /// <summary>Get the annotation styles for a line (Scintilla feature 2545)</summary>
  3651. public unsafe string AnnotationGetStyles(int line)
  3652. {
  3653. byte[] stylesBuffer = new byte[10000];
  3654. fixed (byte* stylesPtr = stylesBuffer)
  3655. {
  3656. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLES, line, (IntPtr) stylesPtr);
  3657. return Encoding.UTF8.GetString(stylesBuffer).TrimEnd('\0');
  3658. }
  3659. }
  3660. /// <summary>Get the number of annotation lines for a line (Scintilla feature 2546)</summary>
  3661. public int AnnotationGetLines(int line)
  3662. {
  3663. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETLINES, line, Unused);
  3664. return (int) res;
  3665. }
  3666. /// <summary>Clear the annotations from all lines (Scintilla feature 2547)</summary>
  3667. public void AnnotationClearAll()
  3668. {
  3669. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONCLEARALL, Unused, Unused);
  3670. }
  3671. /// <summary>Set the visibility for the annotations for a view (Scintilla feature 2548)</summary>
  3672. public void AnnotationSetVisible(int visible)
  3673. {
  3674. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETVISIBLE, visible, Unused);
  3675. }
  3676. /// <summary>Get the visibility for the annotations for a view (Scintilla feature 2549)</summary>
  3677. public int AnnotationGetVisible()
  3678. {
  3679. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETVISIBLE, Unused, Unused);
  3680. return (int) res;
  3681. }
  3682. /// <summary>Get the start of the range of style numbers used for annotations (Scintilla feature 2550)</summary>
  3683. public void AnnotationSetStyleOffset(int style)
  3684. {
  3685. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONSETSTYLEOFFSET, style, Unused);
  3686. }
  3687. /// <summary>Get the start of the range of style numbers used for annotations (Scintilla feature 2551)</summary>
  3688. public int AnnotationGetStyleOffset()
  3689. {
  3690. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ANNOTATIONGETSTYLEOFFSET, Unused, Unused);
  3691. return (int) res;
  3692. }
  3693. /// <summary>Release all extended (>255) style numbers (Scintilla feature 2552)</summary>
  3694. public void ReleaseAllExtendedStyles()
  3695. {
  3696. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RELEASEALLEXTENDEDSTYLES, Unused, Unused);
  3697. }
  3698. /// <summary>Allocate some extended (>255) style numbers and return the start of the range (Scintilla feature 2553)</summary>
  3699. public int AllocateExtendedStyles(int numberStyles)
  3700. {
  3701. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATEEXTENDEDSTYLES, numberStyles, Unused);
  3702. return (int) res;
  3703. }
  3704. /// <summary>Add a container action to the undo stack (Scintilla feature 2560)</summary>
  3705. public void AddUndoAction(int token, int flags)
  3706. {
  3707. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDUNDOACTION, token, flags);
  3708. }
  3709. /// <summary>Find the position of a character from a point within the window. (Scintilla feature 2561)</summary>
  3710. public Position CharPositionFromPoint(int x, int y)
  3711. {
  3712. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINT, x, y);
  3713. return new Position((int) res);
  3714. }
  3715. /// <summary>
  3716. /// Find the position of a character from a point within the window.
  3717. /// Return INVALID_POSITION if not close to text.
  3718. /// (Scintilla feature 2562)
  3719. /// </summary>
  3720. public Position CharPositionFromPointClose(int x, int y)
  3721. {
  3722. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHARPOSITIONFROMPOINTCLOSE, x, y);
  3723. return new Position((int) res);
  3724. }
  3725. /// <summary>Set whether switching to rectangular mode while selecting with the mouse is allowed. (Scintilla feature 2668)</summary>
  3726. public void SetMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch)
  3727. {
  3728. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMOUSESELECTIONRECTANGULARSWITCH, mouseSelectionRectangularSwitch ? 1 : 0, Unused);
  3729. }
  3730. /// <summary>Whether switching to rectangular mode while selecting with the mouse is allowed. (Scintilla feature 2669)</summary>
  3731. public bool GetMouseSelectionRectangularSwitch()
  3732. {
  3733. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMOUSESELECTIONRECTANGULARSWITCH, Unused, Unused);
  3734. return 1 == (int) res;
  3735. }
  3736. /// <summary>Set whether multiple selections can be made (Scintilla feature 2563)</summary>
  3737. public void SetMultipleSelection(bool multipleSelection)
  3738. {
  3739. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMULTIPLESELECTION, multipleSelection ? 1 : 0, Unused);
  3740. }
  3741. /// <summary>Whether multiple selections can be made (Scintilla feature 2564)</summary>
  3742. public bool GetMultipleSelection()
  3743. {
  3744. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMULTIPLESELECTION, Unused, Unused);
  3745. return 1 == (int) res;
  3746. }
  3747. /// <summary>Set whether typing can be performed into multiple selections (Scintilla feature 2565)</summary>
  3748. public void SetAdditionalSelectionTyping(bool additionalSelectionTyping)
  3749. {
  3750. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELECTIONTYPING, additionalSelectionTyping ? 1 : 0, Unused);
  3751. }
  3752. /// <summary>Whether typing can be performed into multiple selections (Scintilla feature 2566)</summary>
  3753. public bool GetAdditionalSelectionTyping()
  3754. {
  3755. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELECTIONTYPING, Unused, Unused);
  3756. return 1 == (int) res;
  3757. }
  3758. /// <summary>Set whether additional carets will blink (Scintilla feature 2567)</summary>
  3759. public void SetAdditionalCaretsBlink(bool additionalCaretsBlink)
  3760. {
  3761. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSBLINK, additionalCaretsBlink ? 1 : 0, Unused);
  3762. }
  3763. /// <summary>Whether additional carets will blink (Scintilla feature 2568)</summary>
  3764. public bool GetAdditionalCaretsBlink()
  3765. {
  3766. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSBLINK, Unused, Unused);
  3767. return 1 == (int) res;
  3768. }
  3769. /// <summary>Set whether additional carets are visible (Scintilla feature 2608)</summary>
  3770. public void SetAdditionalCaretsVisible(bool additionalCaretsBlink)
  3771. {
  3772. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETSVISIBLE, additionalCaretsBlink ? 1 : 0, Unused);
  3773. }
  3774. /// <summary>Whether additional carets are visible (Scintilla feature 2609)</summary>
  3775. public bool GetAdditionalCaretsVisible()
  3776. {
  3777. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETSVISIBLE, Unused, Unused);
  3778. return 1 == (int) res;
  3779. }
  3780. /// <summary>How many selections are there? (Scintilla feature 2570)</summary>
  3781. public int GetSelections()
  3782. {
  3783. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONS, Unused, Unused);
  3784. return (int) res;
  3785. }
  3786. /// <summary>Is every selected range empty? (Scintilla feature 2650)</summary>
  3787. public bool GetSelectionEmpty()
  3788. {
  3789. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONEMPTY, Unused, Unused);
  3790. return 1 == (int) res;
  3791. }
  3792. /// <summary>Clear selections to a single empty stream selection (Scintilla feature 2571)</summary>
  3793. public void ClearSelections()
  3794. {
  3795. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARSELECTIONS, Unused, Unused);
  3796. }
  3797. /// <summary>Set a simple selection (Scintilla feature 2572)</summary>
  3798. public int SetSelection(int caret, int anchor)
  3799. {
  3800. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTION, caret, anchor);
  3801. return (int) res;
  3802. }
  3803. /// <summary>Add a selection (Scintilla feature 2573)</summary>
  3804. public int AddSelection(int caret, int anchor)
  3805. {
  3806. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ADDSELECTION, caret, anchor);
  3807. return (int) res;
  3808. }
  3809. /// <summary>Drop one selection (Scintilla feature 2671)</summary>
  3810. public void DropSelectionN(int selection)
  3811. {
  3812. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DROPSELECTIONN, selection, Unused);
  3813. }
  3814. /// <summary>Set the main selection (Scintilla feature 2574)</summary>
  3815. public void SetMainSelection(int selection)
  3816. {
  3817. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETMAINSELECTION, selection, Unused);
  3818. }
  3819. /// <summary>Which selection is the main selection (Scintilla feature 2575)</summary>
  3820. public int GetMainSelection()
  3821. {
  3822. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETMAINSELECTION, Unused, Unused);
  3823. return (int) res;
  3824. }
  3825. /// <summary>Which selection is the main selection (Scintilla feature 2576)</summary>
  3826. public void SetSelectionNCaret(int selection, Position pos)
  3827. {
  3828. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARET, selection, pos.Value);
  3829. }
  3830. /// <summary>Which selection is the main selection (Scintilla feature 2577)</summary>
  3831. public Position GetSelectionNCaret(int selection)
  3832. {
  3833. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARET, selection, Unused);
  3834. return new Position((int) res);
  3835. }
  3836. /// <summary>Which selection is the main selection (Scintilla feature 2578)</summary>
  3837. public void SetSelectionNAnchor(int selection, Position posAnchor)
  3838. {
  3839. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHOR, selection, posAnchor.Value);
  3840. }
  3841. /// <summary>Which selection is the main selection (Scintilla feature 2579)</summary>
  3842. public Position GetSelectionNAnchor(int selection)
  3843. {
  3844. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHOR, selection, Unused);
  3845. return new Position((int) res);
  3846. }
  3847. /// <summary>Which selection is the main selection (Scintilla feature 2580)</summary>
  3848. public void SetSelectionNCaretVirtualSpace(int selection, int space)
  3849. {
  3850. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNCARETVIRTUALSPACE, selection, space);
  3851. }
  3852. /// <summary>Which selection is the main selection (Scintilla feature 2581)</summary>
  3853. public int GetSelectionNCaretVirtualSpace(int selection)
  3854. {
  3855. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNCARETVIRTUALSPACE, selection, Unused);
  3856. return (int) res;
  3857. }
  3858. /// <summary>Which selection is the main selection (Scintilla feature 2582)</summary>
  3859. public void SetSelectionNAnchorVirtualSpace(int selection, int space)
  3860. {
  3861. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNANCHORVIRTUALSPACE, selection, space);
  3862. }
  3863. /// <summary>Which selection is the main selection (Scintilla feature 2583)</summary>
  3864. public int GetSelectionNAnchorVirtualSpace(int selection)
  3865. {
  3866. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNANCHORVIRTUALSPACE, selection, Unused);
  3867. return (int) res;
  3868. }
  3869. /// <summary>Sets the position that starts the selection - this becomes the anchor. (Scintilla feature 2584)</summary>
  3870. public void SetSelectionNStart(int selection, Position pos)
  3871. {
  3872. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNSTART, selection, pos.Value);
  3873. }
  3874. /// <summary>Returns the position at the start of the selection. (Scintilla feature 2585)</summary>
  3875. public Position GetSelectionNStart(int selection)
  3876. {
  3877. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNSTART, selection, Unused);
  3878. return new Position((int) res);
  3879. }
  3880. /// <summary>Sets the position that ends the selection - this becomes the currentPosition. (Scintilla feature 2586)</summary>
  3881. public void SetSelectionNEnd(int selection, Position pos)
  3882. {
  3883. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETSELECTIONNEND, selection, pos.Value);
  3884. }
  3885. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2587)</summary>
  3886. public Position GetSelectionNEnd(int selection)
  3887. {
  3888. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSELECTIONNEND, selection, Unused);
  3889. return new Position((int) res);
  3890. }
  3891. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2588)</summary>
  3892. public void SetRectangularSelectionCaret(Position pos)
  3893. {
  3894. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARET, pos.Value, Unused);
  3895. }
  3896. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2589)</summary>
  3897. public Position GetRectangularSelectionCaret()
  3898. {
  3899. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARET, Unused, Unused);
  3900. return new Position((int) res);
  3901. }
  3902. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2590)</summary>
  3903. public void SetRectangularSelectionAnchor(Position posAnchor)
  3904. {
  3905. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHOR, posAnchor.Value, Unused);
  3906. }
  3907. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2591)</summary>
  3908. public Position GetRectangularSelectionAnchor()
  3909. {
  3910. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHOR, Unused, Unused);
  3911. return new Position((int) res);
  3912. }
  3913. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2592)</summary>
  3914. public void SetRectangularSelectionCaretVirtualSpace(int space)
  3915. {
  3916. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, space, Unused);
  3917. }
  3918. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2593)</summary>
  3919. public int GetRectangularSelectionCaretVirtualSpace()
  3920. {
  3921. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, Unused, Unused);
  3922. return (int) res;
  3923. }
  3924. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2594)</summary>
  3925. public void SetRectangularSelectionAnchorVirtualSpace(int space)
  3926. {
  3927. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, space, Unused);
  3928. }
  3929. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2595)</summary>
  3930. public int GetRectangularSelectionAnchorVirtualSpace()
  3931. {
  3932. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, Unused, Unused);
  3933. return (int) res;
  3934. }
  3935. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2596)</summary>
  3936. public void SetVirtualSpaceOptions(int virtualSpaceOptions)
  3937. {
  3938. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETVIRTUALSPACEOPTIONS, virtualSpaceOptions, Unused);
  3939. }
  3940. /// <summary>Returns the position at the end of the selection. (Scintilla feature 2597)</summary>
  3941. public int GetVirtualSpaceOptions()
  3942. {
  3943. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETVIRTUALSPACEOPTIONS, Unused, Unused);
  3944. return (int) res;
  3945. }
  3946. /// <summary>
  3947. /// On GTK+, allow selecting the modifier key to use for mouse-based
  3948. /// rectangular selection. Often the window manager requires Alt+Mouse Drag
  3949. /// for moving windows.
  3950. /// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
  3951. /// (Scintilla feature 2598)
  3952. /// </summary>
  3953. public void SetRectangularSelectionModifier(int modifier)
  3954. {
  3955. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETRECTANGULARSELECTIONMODIFIER, modifier, Unused);
  3956. }
  3957. /// <summary>Get the modifier key used for rectangular selection. (Scintilla feature 2599)</summary>
  3958. public int GetRectangularSelectionModifier()
  3959. {
  3960. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRECTANGULARSELECTIONMODIFIER, Unused, Unused);
  3961. return (int) res;
  3962. }
  3963. /// <summary>
  3964. /// Set the foreground colour of additional selections.
  3965. /// Must have previously called SetSelFore with non-zero first argument for this to have an effect.
  3966. /// (Scintilla feature 2600)
  3967. /// </summary>
  3968. public void SetAdditionalSelFore(Colour fore)
  3969. {
  3970. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELFORE, fore.Value, Unused);
  3971. }
  3972. /// <summary>
  3973. /// Set the background colour of additional selections.
  3974. /// Must have previously called SetSelBack with non-zero first argument for this to have an effect.
  3975. /// (Scintilla feature 2601)
  3976. /// </summary>
  3977. public void SetAdditionalSelBack(Colour back)
  3978. {
  3979. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELBACK, back.Value, Unused);
  3980. }
  3981. /// <summary>Set the alpha of the selection. (Scintilla feature 2602)</summary>
  3982. public void SetAdditionalSelAlpha(int alpha)
  3983. {
  3984. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALSELALPHA, alpha, Unused);
  3985. }
  3986. /// <summary>Get the alpha of the selection. (Scintilla feature 2603)</summary>
  3987. public int GetAdditionalSelAlpha()
  3988. {
  3989. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALSELALPHA, Unused, Unused);
  3990. return (int) res;
  3991. }
  3992. /// <summary>Set the foreground colour of additional carets. (Scintilla feature 2604)</summary>
  3993. public void SetAdditionalCaretFore(Colour fore)
  3994. {
  3995. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETADDITIONALCARETFORE, fore.Value, Unused);
  3996. }
  3997. /// <summary>Get the foreground colour of additional carets. (Scintilla feature 2605)</summary>
  3998. public Colour GetAdditionalCaretFore()
  3999. {
  4000. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETADDITIONALCARETFORE, Unused, Unused);
  4001. return new Colour((int) res);
  4002. }
  4003. /// <summary>Set the main selection to the next selection. (Scintilla feature 2606)</summary>
  4004. public void RotateSelection()
  4005. {
  4006. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ROTATESELECTION, Unused, Unused);
  4007. }
  4008. /// <summary>Swap that caret and anchor of the main selection. (Scintilla feature 2607)</summary>
  4009. public void SwapMainAnchorCaret()
  4010. {
  4011. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SWAPMAINANCHORCARET, Unused, Unused);
  4012. }
  4013. /// <summary>
  4014. /// Indicate that the internal state of a lexer has changed over a range and therefore
  4015. /// there may be a need to redraw.
  4016. /// (Scintilla feature 2617)
  4017. /// </summary>
  4018. public int ChangeLexerState(Position start, Position end)
  4019. {
  4020. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CHANGELEXERSTATE, start.Value, end.Value);
  4021. return (int) res;
  4022. }
  4023. /// <summary>
  4024. /// Find the next line at or after lineStart that is a contracted fold header line.
  4025. /// Return -1 when no more lines.
  4026. /// (Scintilla feature 2618)
  4027. /// </summary>
  4028. public int ContractedFoldNext(int lineStart)
  4029. {
  4030. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CONTRACTEDFOLDNEXT, lineStart, Unused);
  4031. return (int) res;
  4032. }
  4033. /// <summary>Centre current line in window. (Scintilla feature 2619)</summary>
  4034. public void VerticalCentreCaret()
  4035. {
  4036. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VERTICALCENTRECARET, Unused, Unused);
  4037. }
  4038. /// <summary>Move the selected lines up one line, shifting the line above after the selection (Scintilla feature 2620)</summary>
  4039. public void MoveSelectedLinesUp()
  4040. {
  4041. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESUP, Unused, Unused);
  4042. }
  4043. /// <summary>Move the selected lines down one line, shifting the line below before the selection (Scintilla feature 2621)</summary>
  4044. public void MoveSelectedLinesDown()
  4045. {
  4046. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MOVESELECTEDLINESDOWN, Unused, Unused);
  4047. }
  4048. /// <summary>Set the identifier reported as IdFrom in notification messages. (Scintilla feature 2622)</summary>
  4049. public void SetIdentifier(int identifier)
  4050. {
  4051. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIER, identifier, Unused);
  4052. }
  4053. /// <summary>Get the identifier. (Scintilla feature 2623)</summary>
  4054. public int GetIdentifier()
  4055. {
  4056. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETIDENTIFIER, Unused, Unused);
  4057. return (int) res;
  4058. }
  4059. /// <summary>Set the width for future RGBA image data. (Scintilla feature 2624)</summary>
  4060. public void RGBAImageSetWidth(int width)
  4061. {
  4062. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETWIDTH, width, Unused);
  4063. }
  4064. /// <summary>Set the height for future RGBA image data. (Scintilla feature 2625)</summary>
  4065. public void RGBAImageSetHeight(int height)
  4066. {
  4067. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETHEIGHT, height, Unused);
  4068. }
  4069. /// <summary>Set the scale factor in percent for future RGBA image data. (Scintilla feature 2651)</summary>
  4070. public void RGBAImageSetScale(int scalePercent)
  4071. {
  4072. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_RGBAIMAGESETSCALE, scalePercent, Unused);
  4073. }
  4074. /// <summary>
  4075. /// Define a marker from RGBA data.
  4076. /// It has the width and height from RGBAImageSetWidth/Height
  4077. /// (Scintilla feature 2626)
  4078. /// </summary>
  4079. public unsafe void MarkerDefineRGBAImage(int markerNumber, string pixels)
  4080. {
  4081. fixed (byte* pixelsPtr = Encoding.UTF8.GetBytes(pixels))
  4082. {
  4083. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_MARKERDEFINERGBAIMAGE, markerNumber, (IntPtr) pixelsPtr);
  4084. }
  4085. }
  4086. /// <summary>
  4087. /// Register an RGBA image for use in autocompletion lists.
  4088. /// It has the width and height from RGBAImageSetWidth/Height
  4089. /// (Scintilla feature 2627)
  4090. /// </summary>
  4091. public unsafe void RegisterRGBAImage(int type, string pixels)
  4092. {
  4093. fixed (byte* pixelsPtr = Encoding.UTF8.GetBytes(pixels))
  4094. {
  4095. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_REGISTERRGBAIMAGE, type, (IntPtr) pixelsPtr);
  4096. }
  4097. }
  4098. /// <summary>Scroll to start of document. (Scintilla feature 2628)</summary>
  4099. public void ScrollToStart()
  4100. {
  4101. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOSTART, Unused, Unused);
  4102. }
  4103. /// <summary>Scroll to end of document. (Scintilla feature 2629)</summary>
  4104. public void ScrollToEnd()
  4105. {
  4106. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SCROLLTOEND, Unused, Unused);
  4107. }
  4108. /// <summary>Set the technology used. (Scintilla feature 2630)</summary>
  4109. public void SetTechnology(int technology)
  4110. {
  4111. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETTECHNOLOGY, technology, Unused);
  4112. }
  4113. /// <summary>Get the tech. (Scintilla feature 2631)</summary>
  4114. public int GetTechnology()
  4115. {
  4116. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETTECHNOLOGY, Unused, Unused);
  4117. return (int) res;
  4118. }
  4119. /// <summary>Create an ILoader*. (Scintilla feature 2632)</summary>
  4120. public int CreateLoader(int bytes)
  4121. {
  4122. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CREATELOADER, bytes, Unused);
  4123. return (int) res;
  4124. }
  4125. /// <summary>On OS X, show a find indicator. (Scintilla feature 2640)</summary>
  4126. public void FindIndicatorShow(Position start, Position end)
  4127. {
  4128. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORSHOW, start.Value, end.Value);
  4129. }
  4130. /// <summary>On OS X, flash a find indicator, then fade out. (Scintilla feature 2641)</summary>
  4131. public void FindIndicatorFlash(Position start, Position end)
  4132. {
  4133. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORFLASH, start.Value, end.Value);
  4134. }
  4135. /// <summary>On OS X, hide the find indicator. (Scintilla feature 2642)</summary>
  4136. public void FindIndicatorHide()
  4137. {
  4138. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FINDINDICATORHIDE, Unused, Unused);
  4139. }
  4140. /// <summary>
  4141. /// Move caret to before first visible character on display line.
  4142. /// If already there move to first character on display line.
  4143. /// (Scintilla feature 2652)
  4144. /// </summary>
  4145. public void VCHomeDisplay()
  4146. {
  4147. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAY, Unused, Unused);
  4148. }
  4149. /// <summary>Like VCHomeDisplay but extending selection to new caret position. (Scintilla feature 2653)</summary>
  4150. public void VCHomeDisplayExtend()
  4151. {
  4152. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_VCHOMEDISPLAYEXTEND, Unused, Unused);
  4153. }
  4154. /// <summary>Is the caret line always visible? (Scintilla feature 2654)</summary>
  4155. public bool GetCaretLineVisibleAlways()
  4156. {
  4157. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCARETLINEVISIBLEALWAYS, Unused, Unused);
  4158. return 1 == (int) res;
  4159. }
  4160. /// <summary>Sets the caret line to always visible. (Scintilla feature 2655)</summary>
  4161. public void SetCaretLineVisibleAlways(bool alwaysVisible)
  4162. {
  4163. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEVISIBLEALWAYS, alwaysVisible ? 1 : 0, Unused);
  4164. }
  4165. /// <summary>Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. (Scintilla feature 2656)</summary>
  4166. public void SetLineEndTypesAllowed(int lineEndBitSet)
  4167. {
  4168. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLINEENDTYPESALLOWED, lineEndBitSet, Unused);
  4169. }
  4170. /// <summary>Get the line end types currently allowed. (Scintilla feature 2657)</summary>
  4171. public int GetLineEndTypesAllowed()
  4172. {
  4173. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESALLOWED, Unused, Unused);
  4174. return (int) res;
  4175. }
  4176. /// <summary>Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. (Scintilla feature 2658)</summary>
  4177. public int GetLineEndTypesActive()
  4178. {
  4179. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESACTIVE, Unused, Unused);
  4180. return (int) res;
  4181. }
  4182. /// <summary>Set the way a character is drawn. (Scintilla feature 2665)</summary>
  4183. public unsafe void SetRepresentation(string encodedCharacter, string representation)
  4184. {
  4185. fixed (byte* encodedCharacterPtr = Encoding.UTF8.GetBytes(encodedCharacter))
  4186. {
  4187. fixed (byte* representationPtr = Encoding.UTF8.GetBytes(representation))
  4188. {
  4189. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETREPRESENTATION, (IntPtr) encodedCharacterPtr, (IntPtr) representationPtr);
  4190. }
  4191. }
  4192. }
  4193. /// <summary>
  4194. /// Set the way a character is drawn.
  4195. /// Result is NUL-terminated.
  4196. /// (Scintilla feature 2666)
  4197. /// </summary>
  4198. public unsafe string GetRepresentation(string encodedCharacter)
  4199. {
  4200. fixed (byte* encodedCharacterPtr = Encoding.UTF8.GetBytes(encodedCharacter))
  4201. {
  4202. byte[] representationBuffer = new byte[10000];
  4203. fixed (byte* representationPtr = representationBuffer)
  4204. {
  4205. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETREPRESENTATION, (IntPtr) encodedCharacterPtr, (IntPtr) representationPtr);
  4206. return Encoding.UTF8.GetString(representationBuffer).TrimEnd('\0');
  4207. }
  4208. }
  4209. }
  4210. /// <summary>Remove a character representation. (Scintilla feature 2667)</summary>
  4211. public unsafe void ClearRepresentation(string encodedCharacter)
  4212. {
  4213. fixed (byte* encodedCharacterPtr = Encoding.UTF8.GetBytes(encodedCharacter))
  4214. {
  4215. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_CLEARREPRESENTATION, (IntPtr) encodedCharacterPtr, Unused);
  4216. }
  4217. }
  4218. /// <summary>Start notifying the container of all key presses and commands. (Scintilla feature 3001)</summary>
  4219. public void StartRecord()
  4220. {
  4221. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STARTRECORD, Unused, Unused);
  4222. }
  4223. /// <summary>Stop notifying the container of all key presses and commands. (Scintilla feature 3002)</summary>
  4224. public void StopRecord()
  4225. {
  4226. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_STOPRECORD, Unused, Unused);
  4227. }
  4228. /// <summary>Set the lexing language of the document. (Scintilla feature 4001)</summary>
  4229. public void SetLexer(int lexer)
  4230. {
  4231. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXER, lexer, Unused);
  4232. }
  4233. /// <summary>Retrieve the lexing language of the document. (Scintilla feature 4002)</summary>
  4234. public int GetLexer()
  4235. {
  4236. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLEXER, Unused, Unused);
  4237. return (int) res;
  4238. }
  4239. /// <summary>Colourise a segment of the document using the current lexing language. (Scintilla feature 4003)</summary>
  4240. public void Colourise(Position start, Position end)
  4241. {
  4242. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_COLOURISE, start.Value, end.Value);
  4243. }
  4244. /// <summary>Set up a value that may be used by a lexer for some optional feature. (Scintilla feature 4004)</summary>
  4245. public unsafe void SetProperty(string key, string value)
  4246. {
  4247. fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key))
  4248. {
  4249. fixed (byte* valuePtr = Encoding.UTF8.GetBytes(value))
  4250. {
  4251. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETPROPERTY, (IntPtr) keyPtr, (IntPtr) valuePtr);
  4252. }
  4253. }
  4254. }
  4255. /// <summary>Set up the key words used by the lexer. (Scintilla feature 4005)</summary>
  4256. public unsafe void SetKeyWords(int keywordSet, string keyWords)
  4257. {
  4258. fixed (byte* keyWordsPtr = Encoding.UTF8.GetBytes(keyWords))
  4259. {
  4260. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYWORDS, keywordSet, (IntPtr) keyWordsPtr);
  4261. }
  4262. }
  4263. /// <summary>Set the lexing language of the document based on string name. (Scintilla feature 4006)</summary>
  4264. public unsafe void SetLexerLanguage(string language)
  4265. {
  4266. fixed (byte* languagePtr = Encoding.UTF8.GetBytes(language))
  4267. {
  4268. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETLEXERLANGUAGE, Unused, (IntPtr) languagePtr);
  4269. }
  4270. }
  4271. /// <summary>Load a lexer library (dll / so). (Scintilla feature 4007)</summary>
  4272. public unsafe void LoadLexerLibrary(string path)
  4273. {
  4274. fixed (byte* pathPtr = Encoding.UTF8.GetBytes(path))
  4275. {
  4276. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_LOADLEXERLIBRARY, Unused, (IntPtr) pathPtr);
  4277. }
  4278. }
  4279. /// <summary>
  4280. /// Retrieve a "property" value previously set with SetProperty.
  4281. /// Result is NUL-terminated.
  4282. /// (Scintilla feature 4008)
  4283. /// </summary>
  4284. public unsafe string GetProperty(string key)
  4285. {
  4286. fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key))
  4287. {
  4288. byte[] bufBuffer = new byte[10000];
  4289. fixed (byte* bufPtr = bufBuffer)
  4290. {
  4291. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTY, (IntPtr) keyPtr, (IntPtr) bufPtr);
  4292. return Encoding.UTF8.GetString(bufBuffer).TrimEnd('\0');
  4293. }
  4294. }
  4295. }
  4296. /// <summary>
  4297. /// Retrieve a "property" value previously set with SetProperty,
  4298. /// with "$()" variable replacement on returned buffer.
  4299. /// Result is NUL-terminated.
  4300. /// (Scintilla feature 4009)
  4301. /// </summary>
  4302. public unsafe string GetPropertyExpanded(string key)
  4303. {
  4304. fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key))
  4305. {
  4306. byte[] bufBuffer = new byte[10000];
  4307. fixed (byte* bufPtr = bufBuffer)
  4308. {
  4309. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTYEXPANDED, (IntPtr) keyPtr, (IntPtr) bufPtr);
  4310. return Encoding.UTF8.GetString(bufBuffer).TrimEnd('\0');
  4311. }
  4312. }
  4313. }
  4314. /// <summary>
  4315. /// Retrieve a "property" value previously set with SetProperty,
  4316. /// interpreted as an int AFTER any "$()" variable replacement.
  4317. /// (Scintilla feature 4010)
  4318. /// </summary>
  4319. public unsafe int GetPropertyInt(string key)
  4320. {
  4321. fixed (byte* keyPtr = Encoding.UTF8.GetBytes(key))
  4322. {
  4323. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPROPERTYINT, (IntPtr) keyPtr, Unused);
  4324. return (int) res;
  4325. }
  4326. }
  4327. /// <summary>Retrieve the number of bits the current lexer needs for styling. (Scintilla feature 4011)</summary>
  4328. public int GetStyleBitsNeeded()
  4329. {
  4330. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEBITSNEEDED, Unused, Unused);
  4331. return (int) res;
  4332. }
  4333. /// <summary>
  4334. /// Retrieve the name of the lexer.
  4335. /// Return the length of the text.
  4336. /// Result is NUL-terminated.
  4337. /// (Scintilla feature 4012)
  4338. /// </summary>
  4339. public unsafe string GetLexerLanguage()
  4340. {
  4341. byte[] textBuffer = new byte[10000];
  4342. fixed (byte* textPtr = textBuffer)
  4343. {
  4344. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLEXERLANGUAGE, Unused, (IntPtr) textPtr);
  4345. return Encoding.UTF8.GetString(textBuffer).TrimEnd('\0');
  4346. }
  4347. }
  4348. /// <summary>For private communication between an application and a known lexer. (Scintilla feature 4013)</summary>
  4349. public int PrivateLexerCall(int operation, int pointer)
  4350. {
  4351. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PRIVATELEXERCALL, operation, pointer);
  4352. return (int) res;
  4353. }
  4354. /// <summary>
  4355. /// Retrieve a '\n' separated list of properties understood by the current lexer.
  4356. /// Result is NUL-terminated.
  4357. /// (Scintilla feature 4014)
  4358. /// </summary>
  4359. public unsafe string PropertyNames()
  4360. {
  4361. byte[] namesBuffer = new byte[10000];
  4362. fixed (byte* namesPtr = namesBuffer)
  4363. {
  4364. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PROPERTYNAMES, Unused, (IntPtr) namesPtr);
  4365. return Encoding.UTF8.GetString(namesBuffer).TrimEnd('\0');
  4366. }
  4367. }
  4368. /// <summary>Retrieve the type of a property. (Scintilla feature 4015)</summary>
  4369. public unsafe int PropertyType(string name)
  4370. {
  4371. fixed (byte* namePtr = Encoding.UTF8.GetBytes(name))
  4372. {
  4373. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_PROPERTYTYPE, (IntPtr) namePtr, Unused);
  4374. return (int) res;
  4375. }
  4376. }
  4377. /// <summary>
  4378. /// Describe a property.
  4379. /// Result is NUL-terminated.
  4380. /// (Scintilla feature 4016)
  4381. /// </summary>
  4382. public unsafe string DescribeProperty(string name)
  4383. {
  4384. fixed (byte* namePtr = Encoding.UTF8.GetBytes(name))
  4385. {
  4386. byte[] descriptionBuffer = new byte[10000];
  4387. fixed (byte* descriptionPtr = descriptionBuffer)
  4388. {
  4389. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DESCRIBEPROPERTY, (IntPtr) namePtr, (IntPtr) descriptionPtr);
  4390. return Encoding.UTF8.GetString(descriptionBuffer).TrimEnd('\0');
  4391. }
  4392. }
  4393. }
  4394. /// <summary>
  4395. /// Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
  4396. /// Result is NUL-terminated.
  4397. /// (Scintilla feature 4017)
  4398. /// </summary>
  4399. public unsafe string DescribeKeyWordSets()
  4400. {
  4401. byte[] descriptionsBuffer = new byte[10000];
  4402. fixed (byte* descriptionsPtr = descriptionsBuffer)
  4403. {
  4404. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DESCRIBEKEYWORDSETS, Unused, (IntPtr) descriptionsPtr);
  4405. return Encoding.UTF8.GetString(descriptionsBuffer).TrimEnd('\0');
  4406. }
  4407. }
  4408. /// <summary>
  4409. /// Bit set of LineEndType enumertion for which line ends beyond the standard
  4410. /// LF, CR, and CRLF are supported by the lexer.
  4411. /// (Scintilla feature 4018)
  4412. /// </summary>
  4413. public int GetLineEndTypesSupported()
  4414. {
  4415. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETLINEENDTYPESSUPPORTED, Unused, Unused);
  4416. return (int) res;
  4417. }
  4418. /// <summary>Allocate a set of sub styles for a particular base style, returning start of range (Scintilla feature 4020)</summary>
  4419. public int AllocateSubStyles(int styleBase, int numberStyles)
  4420. {
  4421. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_ALLOCATESUBSTYLES, styleBase, numberStyles);
  4422. return (int) res;
  4423. }
  4424. /// <summary>The starting style number for the sub styles associated with a base style (Scintilla feature 4021)</summary>
  4425. public int GetSubStylesStart(int styleBase)
  4426. {
  4427. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESSTART, styleBase, Unused);
  4428. return (int) res;
  4429. }
  4430. /// <summary>The number of sub styles associated with a base style (Scintilla feature 4022)</summary>
  4431. public int GetSubStylesLength(int styleBase)
  4432. {
  4433. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLESLENGTH, styleBase, Unused);
  4434. return (int) res;
  4435. }
  4436. /// <summary>For a sub style, return the base style, else return the argument. (Scintilla feature 4027)</summary>
  4437. public int GetStyleFromSubStyle(int subStyle)
  4438. {
  4439. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSTYLEFROMSUBSTYLE, subStyle, Unused);
  4440. return (int) res;
  4441. }
  4442. /// <summary>For a secondary style, return the primary style, else return the argument. (Scintilla feature 4028)</summary>
  4443. public int GetPrimaryStyleFromStyle(int style)
  4444. {
  4445. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETPRIMARYSTYLEFROMSTYLE, style, Unused);
  4446. return (int) res;
  4447. }
  4448. /// <summary>Free allocated sub styles (Scintilla feature 4023)</summary>
  4449. public void FreeSubStyles()
  4450. {
  4451. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_FREESUBSTYLES, Unused, Unused);
  4452. }
  4453. /// <summary>Set the identifiers that are shown in a particular style (Scintilla feature 4024)</summary>
  4454. public unsafe void SetIdentifiers(int style, string identifiers)
  4455. {
  4456. fixed (byte* identifiersPtr = Encoding.UTF8.GetBytes(identifiers))
  4457. {
  4458. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETIDENTIFIERS, style, (IntPtr) identifiersPtr);
  4459. }
  4460. }
  4461. /// <summary>
  4462. /// Where styles are duplicated by a feature such as active/inactive code
  4463. /// return the distance between the two types.
  4464. /// (Scintilla feature 4025)
  4465. /// </summary>
  4466. public int DistanceToSecondaryStyles()
  4467. {
  4468. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_DISTANCETOSECONDARYSTYLES, Unused, Unused);
  4469. return (int) res;
  4470. }
  4471. /// <summary>
  4472. /// Get the set of base styles that can be extended with sub styles
  4473. /// Result is NUL-terminated.
  4474. /// (Scintilla feature 4026)
  4475. /// </summary>
  4476. public unsafe string GetSubStyleBases()
  4477. {
  4478. byte[] stylesBuffer = new byte[10000];
  4479. fixed (byte* stylesPtr = stylesBuffer)
  4480. {
  4481. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETSUBSTYLEBASES, Unused, (IntPtr) stylesPtr);
  4482. return Encoding.UTF8.GetString(stylesBuffer).TrimEnd('\0');
  4483. }
  4484. }
  4485. /// <summary>
  4486. /// Deprecated in 2.30
  4487. /// In palette mode?
  4488. /// (Scintilla feature 2139)
  4489. /// </summary>
  4490. public bool GetUsePalette()
  4491. {
  4492. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETUSEPALETTE, Unused, Unused);
  4493. return 1 == (int) res;
  4494. }
  4495. /// <summary>
  4496. /// In palette mode, Scintilla uses the environment's palette calls to display
  4497. /// more colours. This may lead to ugly displays.
  4498. /// (Scintilla feature 2039)
  4499. /// </summary>
  4500. public void SetUsePalette(bool usePalette)
  4501. {
  4502. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETUSEPALETTE, usePalette ? 1 : 0, Unused);
  4503. }
  4504. /// <summary>
  4505. /// Deprecated in 3.5.5
  4506. /// Always interpret keyboard input as Unicode
  4507. /// (Scintilla feature 2521)
  4508. /// </summary>
  4509. public void SetKeysUnicode(bool keysUnicode)
  4510. {
  4511. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETKEYSUNICODE, keysUnicode ? 1 : 0, Unused);
  4512. }
  4513. /// <summary>Are keys always interpreted as Unicode? (Scintilla feature 2522)</summary>
  4514. public bool GetKeysUnicode()
  4515. {
  4516. IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETKEYSUNICODE, Unused, Unused);
  4517. return 1 == (int) res;
  4518. }
  4519. /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
  4520. }
  4521. }