aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/.buffer.luadoc
blob: 53a3ea74a7bc27f06329de9f0db5587e02ff0c48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
-- Copyright 2007-2012 Mitchell mitchell.att.foicica.com. See LICENSE.
-- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
-- global buffer table.

---
-- The current buffer in the current view.
-- It also represents the structure of any buffer table in `_G._BUFFER`.
-- @field additional_caret_fore (number)
--   The foreground color of additional carets in `0xBBGGRR` format.
-- @field additional_carets_blink (bool)
--   Whether additional carets will blink.
-- @field additional_carets_visible (bool)
--   Whether additional carets are visible.
-- @field additional_sel_alpha (number)
--   The alpha of additional selections. Alpha ranges from `0` (transparent) to
--   `255` (opaque) or `256` for no alpha.
-- @field additional_sel_back (number)
--   The background color of additional selections in `0xBBGGRR` format.
--   `buffer:set_sel_back(true, ...)` must have been called previously for this
--   to have an effect.
-- @field additional_sel_fore (number)
--   The foreground color of additional selections in `0xBBGGRR` format.
--   `buffer:set_sel_fore(true, ...)` must have been called previously for this
--   to have an effect.
-- @field additional_selection_typing (bool)
--   Whether typing can be performed into multiple selections.
-- @field anchor (number)
--   The position of the opposite end of the selection to the caret.
-- @field annotation_lines (table, Read-only)
--   Table of the number of annotation lines for lines starting from zero.
-- @field annotation_style (table)
--   Table of style numbers for annotations for lines starting at zero.
-- @field annotation_style_offset (number)
--   The start of the range of style numbers used for annotations.
--   Annotation styles may be completely separated from standard text styles by
--   setting a style offset. For example, setting this to `512` would allow the
--   annotation styles to be numbered from `512` upto `767` so they do not
--   overlap styles set by lexers (or margins if margins offset is `256`). Each
--   style number set with `buffer.annotation_style` has the offset added before
--   looking up the style.
-- @field annotation_visible (number)
--   The visibility of annotations.
--
--   * `_SCINTILLA.constants.ANNOTATION_HIDDEN` (0)
--     Annotations are not displayed.
--   * `_SCINTILLA.constants.ANNOTATION_STANDARD` (1)
--     Annotations are drawn left justified with no adornment.
--   * `_SCINTILLA.constants.ANNOTATION_BOXED` (2)
--     Annotations are indented to match the text and are surrounded by a box.
-- @field auto_c_auto_hide (bool)
--   Whether or not autocompletion is hidden automatically when nothing matches.
--   By default, the list is cancelled if there are no viable matches (the user
--   has typed characters that no longer match a list entry).
-- @field auto_c_cancel_at_start (bool)
--   Whether auto-completion is cancelled by backspacing to a position before
--   where the box was created.
--   If `false`, the list is not cancelled until the caret moves before the
--   first character of the word being completed. If `true`, cancel if the user
--   backspaces to a position before where it was created.
-- @field auto_c_choose_single (bool)
--   Whether a single item auto-completion list automatically choose the item.
--   The default is to display the list even if there is only a single item.
-- @field auto_c_drop_rest_of_word (bool)
--   Whether or not autocompletion deletes any word characters after the
--   inserted text upon completion.
--   The default is `false`.
-- @field auto_c_fill_ups (string, Write-only)
--   A set of characters that when typed will cause the autocompletion to choose
--   the selected item.
--   By default, no fillup characters are set.
-- @field auto_c_ignore_case (bool)
--   Whether case is significant when performing auto-completion searches.
--   By default, matching of characters to list members is case sensitive.
-- @field auto_c_max_height (number)
--   The maximum height, in rows, of auto-completion and user lists.
--   The default is 5 rows.
-- @field auto_c_max_width (number)
--   The maximum width, in characters, of auto-completion and user lists.
--   Set to `0` to autosize to fit longest item, which is the default.
-- @field auto_c_separator (number)
--   The auto-completion list separator character byte.
--   The default is the space character.
-- @field auto_c_type_separator (number)
--   The auto-completion list type-separator character byte.
--   The default is `'?'`. Autocompletion list items may display an image as
--   well as text. Each image is first registered with an integer type. Then
--   this integer is included in the text of the list separated by a `?` from
--   the text.
-- @field back_space_un_indents (bool)
--   Whether a backspace pressed when caret is within indentation unindents.
-- @field buffered_draw (bool)
--   Whether drawing is buffered.
--   If drawing is buffered then each line of text is drawn into a bitmap buffer
--   before drawing it to the screen to avoid flicker. The default is for
--   drawing to be buffered. first or directly onto the screen.
-- @field call_tip_back (number, Write-only)
--   The background color for the call tip in `0xBBGGRR` format.
-- @field call_tip_fore (number, Write-only)
--   The foreground color for the call tip in `0xBBGGRR` format.
-- @field call_tip_fore_hlt (number, Write-only)
--   The foreground color for the highlighted part of the call tip in `0xBBGGRR`
--   format.
-- @field call_tip_position (boolean)
--   The position of calltip, above or below text.
--   By default the calltip is displayed below the text. Setting to `true` will
--   display it above the text.
-- @field call_tip_use_style (number)
--   Enable use of `_SCINTILLA.constants.STYLE_CALLTIP` and set call tip tab
--   size in pixels.
--   If the tab size is less than `1`, Tab characters are not treated specially.
-- @field caret_fore (number)
--   The foreground color of the caret in `0xBBGGRR` format.
-- @field caret_line_back (number)
--   The color of the background of the line containing the caret in `0xBBGGRR`
--   format.
-- @field caret_line_back_alpha (number)
--   The background alpha of the caret line.
--   Alpha ranges from `0` (transparent) to `255` (opaque) or `256` for no
--   alpha.
-- @field caret_line_visible (bool)
--   Whether the background of the line containing the caret is in a different
--   color.
-- @field caret_period (number)
--   The time in milliseconds that the caret is on and off.
--   Setting the period to `0` stops the caret blinking. The default value is
--   500 milliseconds.
-- @field caret_sticky (number)
--   The caret preferred x position changing when the user types.
--
--   * `_SCINTILLA.constants.SC_CARETSTICKY_OFF` (0)
--     All text changes (and all caret position changes) will remember the
--     caret's new horizontal position when moving to different lines.
--     This is the default.
--   * `_SCINTILLA.constants.SC_CARETSTICKY_ON` (1)
--     The only thing which will cause the editor to remember the horizontal
--     caret position is moving the caret with mouse or keyboard (left/right
--     arrow keys, home/end keys, etc).
--   * `_SCINTILLA.constants.SC_CARETSTICKY_WHITESPACE` (2)
--     The caret acts like sticky off except under one special case; when space
--     or tab characters are inserted. (Including pasting *only space/tabs* --
--     undo, redo, etc. do not exhibit this behavior.)
-- @field caret_style (number)
--   The style of the caret to be drawn.
--
--   * `_SCINTILLA.constants.CARETSTYLE_INVISIBLE` (0)
--     Not draw the caret at all.
--   * `_SCINTILLA.constants.CARETSTYLE_LINE` (1)
--     A line caret. This is the default value.
--   * `_SCINTILLA.constants.CARETSTYLE_BLOCK` (2)
--     A block caret.
-- @field caret_width (number)
--   The width of the insert mode caret in pixels.
--   Can be `0`, `1`, `2` or `3` pixels. The default width is 1 pixel. This
--   setting only affects the width of the cursor when the cursor style is set
--   to line caret mode, it does not affect the width for a block caret.
-- @field char_at (table, Read-only)
--   Table of character bytes at positions in the document starting at zero.
-- @field code_page (number)
--   The code page used to interpret the bytes of the document as characters.
--   The `_SCINTILLA.constants.SC_CP_UTF8` value can be used to enter Unicode
--   mode.
-- @field column (table, Read-only)
--   Table of column numbers, taking tab widths into account, for positions
--   starting from zero.
-- @field control_char_symbol (number)
--   The way control characters are displayed.
--   If less than `32`, keep the rounded rectangle as ASCII mnemonics.
--   Otherwise, use the given character byte. The default value is `0`.
-- @field current_pos (number)
--   The position of the caret.
--   When setting, the caret is not scrolled into view.
-- @field cursor (number)
--   The cursor type.
--
--   * `_SCINTILLA.constants.SC_CURSORNORMAL` (-1)
--     The normal cursor is displayed.
--   * `_SCINTILLA.constants.SC_CURSORWAIT` (4)
--     The wait cursor is displayed when the mouse is over the view.
-- @field direct_function (number, Read-only)
--   A pointer to a function that processes messages for this view.
-- @field direct_pointer (number, Read-only)
--   A pointer value to use as the first argument when calling the function
--   returned by direct_function.
-- @field dirty (bool)
--   Flag indicating whether or not the buffer has been modified since it was
--   last saved.
-- @field eol_mode (number)
--   The current end of line mode.
--
--   * `_SCINTILLA.constants.SC_EOL_CRLF` (0)
--     `CRLF`.
--   * `_SCINTILLA.constants.SC_EOL_CR` (1)
--     `CR`.
--   * `_SCINTILLA.constants.SC_EOL_LF` (2)
--     `LF`.
-- @field edge_colour (number)
--   The color used in edge indication in `0xBBGGRR` format.
-- @field edge_column (number)
--   The column number which text should be kept within.
-- @field edge_mode (number)
--   The edge highlight mode.
--
--   * `_SCINTILLA.constants.EDGE_NONE` (0)
--     Long lines are not marked. This is the default state.
--   * `_SCINTILLA.constants.EDGE_LINE` (1)
--     A vertical line is drawn at the column number set by
--     `buffer.edge_column`.
--   * `_SCINTILLA.constants.EDGE_BACKGROUND` (2)
--     The background color of characters after the column limit is changed to
--     the color set by `buffer.edge_colour`.
-- @field encoding (string or nil)
--   The encoding of the file on the hard disk.
--   It will be `nil` if the file is a binary file.
-- @field encoding_bom (string)
--   The byte-order mark of the file encoding (if any).
-- @field end_at_last_line (bool)
--   Whether the maximum scroll position has the last line at the bottom of the
--   view.
--   If `false`, allows scrolling one page below the last line. The default
--   value is `true`.
-- @field end_styled (number, Read-only)
--   The position of the last correctly styled character.
-- @field extra_ascent (number)
--   The extra ascent, the maximum that any style extends above the baseline,
--   added to each line.
-- @field extra_descent (number)
--   The extra descent, the maximum that any style extends below the baseline,
--   added to each line.
-- @field filename (string)
--   The absolute path to the file associated with this buffer.
--   It is encoded in UTF-8. Use [`string.iconv()`](string.html#iconv) for
--   charset conversions.
-- @field first_visible_line (number)
--   The display line at the top of the display.
-- @field focus (bool)
--   The internal focus flag.
-- @field fold_expanded (bool)
--   Expanded state of a header line.
-- @field fold_level (table)
--   Table of fold levels for lines starting from zero.
--   Fold levels encodes an integer level along with flags indicating whether
--   the line is a header and whether it is effectively white space.
--
--   * `_SCINTILLA.constants.SC_FOLDLEVELBASE` (0x400)
--     Initial fold level.
--   * `_SCINTILLA.constants.SC_FOLDLEVELWHITEFLAG` (0x1000)
--     Indicates that the line is blank.
--   * `_SCINTILLA.constants.SC_FOLDLEVELHEADERFLAG` (0x2000)
--     Indicates that the line is a header (fold point).
-- @field fold_parent (table, Read-only)
--   Table of parent line numbers for child lines starting from zero.
--   `-1` means no line was found.
-- @field font_quality (number) (Windows only)
--   The quality level for text.
--
--   * `_SCINTILLA.constants.SC_EFF_QUALITY_DEFAULt` (0).
--   * `_SCINTILLA.constants.SC_EFF_QUALITY_NON_ANTIALIASED` (1).
--   * `_SCINTILLA.constants.SC_EFF_QUALITY_ANTIALIASED` (2).
--   * `_SCINTILLA.constants.SC_EFF_QUALITY_LCD_OPTIMIZED` (3).
-- @field h_scroll_bar (bool)
--   Whether the horizontal scroll bar is visible.
--   Set to `false` to never see it and `true` to enable it again. The default
--   state is to display it when needed.
-- @field highlight_guide (number)
--   The highlighted indentation guide column.
--   Set to `0` to cancel this highlight.
-- @field hotspot_active_underline (bool)
--   Whether active hotspots are underlined.
-- @field hotspot_single_line (bool)
--   Whether hotspots are limited to single line so hotspots on two lines do not
--   merge.
-- @field indent (number)
--   Ihe number of spaces used for one level of indentation.
--   For a width of `0`, the indent size is the same as the tab size.
-- @field indentation_guides (number)
--   Indentation guides appearance.
--   Indentation guides are dotted vertical lines that appear within indentation
--   white space every indent size columns.
--
--   * `_SCINTILLA.constants.SC_IV_NONE` (0)
--     No indentation guides are shown.
--   * `_SCINTILLA.constants.SC_IV_REAL` (1)
--     Indentation guides are shown inside real indentation white space.
--   * `_SCINTILLA.constants.SC_IV_LOOKFORWARD` (2)
--     Indentation guides are shown beyond the actual indentation up to the
--     level of the next non-empty line.
--     If the previous non-empty line was a fold header then indentation guides
--     are shown for one more level of indent than that line. This setting is
--     good for Python.
--   * `_SCINTILLA.constants.SC_IV_LOOKBOTH` (3)
--     Indentation guides are shown beyond the actual indentation up to the
--     level of the next non-empty line or previous non-empty line whichever is
--     the greater.
--     This setting is good for most languages.
-- @field indic_alpha (table)
--   Table of alpha transparency values ranging from `0` (transparent) to `255`
--   (opaque) or `256` (no alpha) for indicators from `0` to `31`.
--   Used for drawing the fill color of the `INDIC_ROUNDBOX` and
--   `INDIC_STRAIGHTBOX` rectangle.
-- @field indic_fore (table)
--   Table of foreground colors in `0xBBGGRR` format for indicators from `0` to
--   `31`.
-- @field indic_outline_alpha (table)
--   Table of alpha transparency values ranging from `0` (transparent) to `255`
--   (opaque) or `256` (no alpha) for indicators from `0` to `31`.
--   Used for drawing the outline color of the `INDIC_ROUNDBOX` and
--   `INDIC_STRAIGHTBOX` rectangle.
-- @field indic_style (table)
--   Table of styles for indicators from `0` to `31`.
--
--   * `_SCINTILLA.constants.INDIC_PLAIN` (0)
--     Underlined with a single, straight line.
--   * `_SCINTILLA.constants.INDIC_SQUIGGLE` (1)
--     A squiggly underline. Requires 3 pixels of descender space.
--   * `_SCINTILLA.constants.INDIC_TT` (2)
--     A line of small T shapes.
--   * `_SCINTILLA.constants.INDIC_DIAGONAL` (3)
--     Diagonal hatching.
--   * `_SCINTILLA.constants.INDIC_STRIKE` (4)
--     Strike out.
--   * `_SCINTILLA.constants.INDIC_HIDDEN` (5)
--     An indicator with no visual effect.
--   * `_SCINTILLA.constants.INDIC_BOX` (6)
--     A rectangle around the text.
--   * `_SCINTILLA.constants.INDIC_ROUNDBOX` (7)
--     A rectangle with rounded corners around the text using translucent
--     drawing with the interior usually more transparent than the border. Use
--     `buffer.indic_alpha` and `buffer.indic_outline_alpha` to control the
--     alpha transparency values. The default alpha values are `30` for fill
--     color and `50` for outline color.
--   * `_SCINTILLA.constants.INDIC_STRAIGHTBOX` (8)
--     A rectangle around the text using translucent drawing with the interior
--     usually more transparent than the border.
--     You can use `buffer.indic_alpha` and `buffer.indic_outline_alpha` to
--     control the alpha transparency values. The default alpha values are `30`
--     for fill color and `50` for outline color.
--   * `_SCINTILLA.constants.INDIC_DASH` (9)
--     A dashed underline.
--   * `_SCINTILLA.constants.INDIC_DOTS` (10)
--     A dotted underline.
--   * `_SCINTILLA.constants.INDIC_SQUIGGLELOW` (11)
--     Similar to `INDIC_SQUIGGLE` but only using 2 vertical pixels so will fit
--     under small fonts.
--   * `_SCINTILLA.constants.INDIC_DOTBOX` (12)
--     A dotted rectangle around the text using translucent drawing.
--     Translucency alternates between the alpha and outline alpha settings with
--     the top-left pixel using the alpha setting. `buffer.indic_alpha` and
--     `buffer.indic_outline_alpha` control the alpha transparency values.
--     The default values are `30` for alpha and `50` for outline alpha. To
--     avoid excessive memory allocation the maximum width of a dotted box is
--     4000 pixels.
--   * Use `_SCINTILLA.next_indic_number()` for custom indicators.
-- @field indic_under (table)
--   Table of booleans for drawing under text or over (default) for indicators
--   from `0` to `31`.
-- @field indicator_current (number)
--   The indicator in the range of `0` to `31` used for
--   `buffer:indicator_fill_range()` and `buffer:indicator_clear_range()`.
-- @field indicator_value (number)
--   The indicator value used for `buffer:indicator_fill_range()`.
--   Currently all values are drawn the same.
-- @field keys_unicode (bool)
--   Interpret keyboard input as Unicode.
-- @field layout_cache (number)
--   The degree of caching of layout information.
--
--   * `_SCINTILLA.constants.SC_CACHE_NONE` (0)
--     No lines are cached.
--   * `_SCINTILLA.constants.SC_CACHE_CARET` (1)
--     The line containing the text caret.
--     This is the default.
--   * `_SCINTILLA.constants.SC_CACHE_PAGE` (2)
--     Visible lines plus the line containing the caret.
--   * `_SCINTILLA.constants.SC_CACHE_DOCUMENT` (3)
--     All lines in the document.
-- @field length (number, Read-only)
--   The number of bytes in the document.
-- @field lexer (number)
--   The lexing language of the document.
-- @field line_count (number, Read-only)
--   The number of lines in the document.
--   There is always at least one.
-- @field line_end_position (table, Read-only)
--   Table of positions after the last visible characters on a line for lines
--   starting from zero.
-- @field line_indent_position (table, Read-only)
--   Table of positions before the first non indentation character on a line for
--   lines starting from zero.
-- @field line_indentation (table)
--   Table of line indentation amounts for lines starting from zero.
--   The indentation is measured in character columns, which correspond to the
--   width of space characters.
-- @field line_state (table)
--   Table of extra styling information for lines starting from zero.
--   As well as the 8 bits of lexical state stored for each character there is
--   also an integer stored for each line. This can be used for longer lived
--   parse states.
-- @field line_visible (bool, Read-only)
--   Is a line visible?
-- @field lines_on_screen (number, Read-only)
--   The number of lines completely visible.
-- @field lines_visible (bool, Read-only)
--   Are all lines visible?
-- @field main_selection (number)
--   The main selection.
--   The main selection may be displayed in different colors or with a
--   differently styled caret. Only an already existing selection can be made
--   main.
-- @field margin_cursor_n (table)
--   Table of cursors shown for margins from zero to four.
--   A reversed arrow cursor is normally shown over all margins.
--
--   * `_SCINTILLA.constants.SC_CURSORARROW`
--     Normal arrow.
--   * `_SCINTILLA.constants.SC_CURSORREVERSEARROW`
--     Reversed arrow.
-- @field margin_left (number)
--   The size in pixels of the left margin.
--   The default is to one pixel.
-- @field margin_mask_n (table)
--   Table of marker masks for margins from zero to four.
--   A mask determines which markers are displayed in a margin.
-- @field margin_options (number)
--   A bit mask of margin options.
--
--   * `_SCINTILLA.constants.SC_MARGINOPTION_NONE` (0)
--     None (default).
--   * `_SCINTILLA.constants.SC_MARGINOPTION_SUBLINESELECT` (1)
--     Controls how wrapped lines are selected when clicking on margin in front
--     of them.
--     If set, only sub line of wrapped line is selected, otherwise whole
--     wrapped line is selected.
-- @field margin_right (number)
--   The size in pixels of the right margin.
--   The default is to one pixel.
-- @field margin_sensitive_n (table)
--   Table of mouse click sensitivity booleans for margins from zero to four.
--   A click in a sensitive margin emits a `margin_click` event. By default, all
--   margins are insensitive.
-- @field margin_style (table)
--   Table of style numbers for text margin lines starting from zero.
-- @field margin_style_offset (number)
--   The start of the range of style numbers used for margin text.
--   Margin styles may be completely separated from standard text styles by
--   setting a style offset. For example, setting this to `256` would allow the
--   margin styles to be numbered from `256` upto `511` so they do not overlap
--   styles set by lexers. Each style number set with `buffer.margin_style` has
--   the offset added before looking up the style.
-- @field margin_type_n (table)
--   Table of margin types for margins from zero to four.
--
--   * `_SCINTILLA.constants.SC_MARGIN_SYMBOL` (0)
--     A symbol margin.
--   * `_SCINTILLA.constants.SC_MARGIN_NUMBER` (1)
--     A line number margin.
--   * `_SCINTILLA.constants.SC_MARGIN_BACK` (2)
--     A symbol margin that sets its background color to match the default
--     text background color.
--   * `_SCINTILLA.constants.SC_MARGIN_FORE` (3)
--     A symbol margin that sets its background color to match the default
--     text foreground color.
--   * `_SCINTILLA.constants.SC_MARGIN_TEXT` (4)
--     A text margin.
--   * `_SCINTILLA.constants.SC_MARGIN_RTEXT` (5)
--     A right justified text margin.
-- @field margin_width_n (table)
--   Table of margin widths expressed in pixes for margins from zero to four.
-- @field max_line_state (number, Read-only)
--   The last line number that has line state.
-- @field modify (bool)
--   Whether the document is different from when it was last saved.
-- @field mouse_down_captures (bool)
--   Whether the mouse is captured when its button is pressed.
-- @field mouse_dwell_time (number)
--   The time the mouse must sit still to generate a mouse dwell event.
--   If set to `_SCINTILLA.constants.SC_TIME_FOREVER`, the default, no dwell
--   events are generated.
-- @field multi_paste (bool)
--   The effect of pasting when there are multiple selections.
--
--   * `_SCINTILLA.constants.SC_MULTIPASTE_ONCE` (0)
--     Pasted text can go into just the main selection (default).
--   * `_SCINTILLA.constants.SC_MULTIPASTE_EACH` (1)
--     Pasted text can go into each selection.
-- @field multiple_selection (bool)
--   Whether multiple selections can be made.
--   When multiple selection is disabled, it is not possible to select multiple
--   ranges by holding down the Ctrl key while dragging with the mouse.
-- @field overtype (bool)
--   Overtype mode.
-- @field position_cache (number)
--   The number of entries in the position cache.
--   The position cache stores position information for short runs of text so
--   that their layout can be determined more quickly if the run recurs.
-- @field print_colour_mode (number)
--   The print color mode.
--
--   * `_SCINTILLA.constants.SC_PRINT_NORMAL` (0)
--     Print using the current screen colors.
--     This is the default.
--   * `_SCINTILLA.constants.SC_PRINT_INVERTLIGHT` (1)
--     If you use a dark screen background this saves ink by inverting the light
--     value of all colors and printing on a white background.
--   * `_SCINTILLA.constants.SC_PRINT_BLACKONWHITE` (2)
--     Print all text as black on a white background.
--   * `_SCINTILLA.constants.SC_PRINT_COLOURONWHITE` (3)
--     Everything prints in its own color on a white background.
--   * `_SCINTILLA.constants.SC_PRINT_COLOURONWHITEDEFAULTBG` (4)
--     Everything prints in its own color on a white background except that line
--     numbers use their own background color.
-- @field print_magnification (number)
--   The print magnification added to the point size of each style for printing.
-- @field print_wrap_mode (number)
--   Printing line wrap mode.
--
--   * `_SCINTILLA.constants.SC_WRAP_NONE` (0)
--     Each line of text generates one line of output and the line is truncated
--     if it is too long to fit into the print area.
--   * `_SCINTILLA.constants.SC_WRAP_WORD` (1)
--     Wraps printed output so that all characters fit into the print rectangle.
--     Tries to wrap only between words as indicated by white space or style
--     changes although if a word is longer than a line, it will be wrapped
--     before the line end. This is the default.
--   * `_SCINTILLA.constants.SC_WRAP_CHAR` (2).
-- @field property (table, Write-only)
--   Table of keyword:value string pairs used by a lexer for some optional
--   features.
-- @field property_int (table, Read-only)
--   Interprets `buffer.property[keyword]` as an integer if found or returns
--   `0`.
-- @field read_only (bool)
--   Read-only mode.
-- @field rectangular_selection_anchor (number)
--   The position of the anchor of the rectangular selection.
-- @field rectangular_selection_anchor_virtual_space (number)
--   The amount of virtual space for the anchor of the rectangular selection.
-- @field rectangular_selection_caret (number)
--   The position of the caret of the rectangular selection.
-- @field rectangular_selection_caret_virtual_space (number)
--   The amount of virtual space for the caret of the rectangular selection.
-- @field rectangular_selection_modifier (number)
--   The modifier key used to indicate that a rectangular selection should be
--   created when combined with a mouse drag.
--
--   * `_SCINTILLA.constants.SCMOD_CTRL` (2)
--     Control key (default).
--   * `_SCINTILLA.constants.SCMOD_ALT` (4)
--     Alt key.
--   * `_SCINTILLA.constants.SCMOD_SUPER` (8)
--     Left Windows key on a Windows keyboard or the Command key on a Mac.
-- @field rgba_image_height (number)
--   The height for future RGBA image data.
-- @field rgba_image_width (number)
--   The width for future RGBA image data.
-- @field scroll_width (number)
--   The document width assumed for scrolling.
--   For performance, the view does not measure the display width of the
--   document to determine the properties of the horizontal scroll bar. Instead,
--   an assumed width is used. The default value is `2000`. To ensure the width
--   of the currently visible lines can be scrolled use
--   `buffer.scroll_width_tracking`.
-- @field scroll_width_tracking (bool)
--   Whether the maximum width line displayed is used to set scroll width.
-- @field search_flags (number)
--   The search flags used by `buffer:search_in_target()`.
--
--   * `_SCINTILLA.constants.SCFIND_WHOLEWORD` (2)
--     A match only occurs with text that matches the case of the search string.
--   * `_SCINTILLA.constants.SCFIND_MATCHCASE` (4)
--     A match only occurs if the characters before and after are not word
--     characters.
--   * `_SCINTILLA.constants.SCFIND_WORDSTART` (0x00100000)
--     A match only occurs if the character before is not a word character.
--   * `_SCINTILLA.constants.SCFIND_REGEXP` (0x00200000)
--     The search string should be interpreted as a regular expression.
--   * `_SCINTILLA.constants.SCFIND_POSIX` (0x00400000)
--     Treat regular expression in a more POSIX compatible manner by
--     interpreting bare `(` and `)` for tagged sections rather than `\(` and
--     `\)`.
-- @field sel_alpha (number)
--   The alpha of the selection, between `0` (transparent) and `255` (opaque),
--   or `256` for no alpha.
-- @field sel_eol_filled (bool)
--   The selection end of line fill.
--   The selection can be drawn up to the right hand border by setting this
--   property.
-- @field selection_end (number)
--   The position that ends the selection - this becomes the current position.
--   This does not make the caret visible.
-- @field selection_is_rectangle (bool, Read-only)
--   Is the selection rectangular?
--   The alternative is the more common stream selection.
-- @field selection_mode (number)
--   The mode of the current selection.
--
--   * `_SCINTILLA.constants.SC_SEL_STREAM` (0)
--     Stream.
--   * `_SCINTILLA.constants.SC_SEL_RECTANGLE` (1)
--     Rectangle.
--   * `_SCINTILLA.constants.SC_SEL_LINES` (2)
--     Lines.
--   * `_SCINTILLA.constants.SC_SEL_THIN` (3)
--     Thin rectangular.
-- @field selection_n_anchor (table)
--   Table of anchor positions for existing selections starting from zero, the
--   main selection.
-- @field selection_n_anchor_virtual_space (table)
--   Table of the amount of virtual space for anchors for existing selections
--   starting from zero, the main selection.
-- @field selection_n_caret (table)
--   Table of caret positions for existing selections starting from zero, the
--   main selection.
-- @field selection_n_caret_virtual_space (table)
--   Table of the amount of virtual space for carets for existing selections
--   starting from zero, the main selection.
-- @field selection_n_end (table)
--   Table of positions that end selections for existing selections starting
--   from zero, the main selection.
-- @field selection_n_start (table)
--   Table of positions that start selections for existing selections starting
--   from zero, the main selection.
-- @field selection_start (number)
--   The position that starts the selection - this becomes the anchor.
--   This does not make the caret visible.
-- @field selections (number, Read-only)
--   The number of selections currently active.
-- @field status (number)
--   The error status.
--
--   * `_SCINTILLA.constants.SC_STATUS_OK` (0)
--     No failures.
--   * `_SCINTILLA.constants.SC_STATUS_FAILURE` (1)
--     Generic failure.
--   * `_SCINTILLA.constants.SC_STATUS_BADALLOC` (2)
--     Memory is exhausted.
-- @field style_at (table, Read-only)
--   Table of style bytes at positions in the document starting at zero.
-- @field style_back (table)
--   Table of background colors in `0xBBGGRR` format for styles from `0` to
--   `255`.
-- @field style_bits (number)
--   The number of bits in style bytes used to hold the lexical state.
-- @field style_bits_needed (number, Read-only)
--   The number of bits the current lexer needs for styling.
-- @field style_bold (table)
--   Table of booleans for bold styles from `0` to `255`.
-- @field style_case (table)
--   Table of cases for styles from `0` to `255`.
--
--   * `_SCINTILLA.constants.SC_CASE_MIXED` (0)
--     Normal, mixed case.
--   * `_SCINTILLA.constants.SC_CASE_UPPER` (1)
--     Upper case.
--   * `_SCINTILLA.constants.SC_CASE_LOWER` (2)
--     Lower case.
-- @field style_changeable (table)
--   Table of booleans for changeable styles from `0` to `255`.
--   The default setting is `true`.
-- @field style_character_set (table)
--   Table of character sets for styles from `0` to `255`.
-- @field style_eol_filled (table)
--   Table of booleans for end of line filled styles from `0` to `255`.
-- @field style_font (table)
--   Table of font faces for styles from `0` to `255`.
-- @field style_fore (table)
--   Table of foreground colors in `0xBBGGRR` format for styles from `0` to
--   `255`.
-- @field style_hot_spot (table)
--   Table of boolean hotspot styles from `0` to `255`.
-- @field style_italic (table)
--   Table of booleans for italic styles from `0` to `255`.
-- @field style_size (table)
--   Table of font sizes for styles from `0` to `255`.
--   Font size is a whole number of points.
-- @field style_size_fractional (table)
--   Table of sizes of characters for styles from `0` to `255`.
--   Size is in hundreths of a point and multiplied by 100 internally. For
--   example, a text size of 9.4 points is set with 940.
-- @field style_underline (table)
--   Table of booleans for underlined styles from `0` to `255`.
-- @field style_visible (table)
--   Table of booleans for visible styles from `0` to `255`.
-- @field style_weight (table)
--   Table of character weights for styles from `0` to `255`.
--   The weight or boldness of a font can be set with a number between 1 and 999
--   with 1 being very light and 999 very heavy. While any value can be used,
--   fonts often only support between 2 and 4 weights with three weights being
--   common enough to use symbolic names:
--
--   * `_SCINTILLA.constants.SC_WEIGHT_NORMAL` (400)
--     Normal.
--   * `_SCINTILLA.constants.SC_WEIGHT_SEMIBOLD` (600)
--     Semi-bold.
--   * `_SCINTILLA.constants.SC_WEIGHT_BOLD` (700)
--     Bold.
-- @field tab_indents (bool)
--   Whether a tab pressed when caret is within indentation indents.
-- @field tab_width (number)
--   The visible size of a tab as a multiple of the width of a space character.
--   The default tab width is 8 characters.
-- @field target_end (number)
--   The position that ends the target which is used for updating the document
--   without affecting the scroll position.
--   The target is also set by a successful `buffer:search_in_target()`.
-- @field target_start (number)
--   The position that starts the target which is used for updating the document
--   without affecting the scroll position.
--   The target is also set by a successful `buffer:search_in_target()`.
-- @field text_length (number, Read-only)
--   The number of characters in the document.
-- @field two_phase_draw (bool)
--   Two phase drawing mode.
--   When `true`, drawing is performed in two phases, first the background and
--   then the foreground. This avoids chopping off characters that overlap the
--   next run. The default is for drawing to be two phase.
-- @field undo_collection (bool)
--   Whether to collect undo information.
--   When stopping collection, use `buffer:empty_undo_buffer()` to avoid the
--   undo buffer being unsynchronized with the data in the buffer.
-- @field use_tabs (bool)
--   Whether tabs will be used in indentation.
--   The default is `true`. `false` will only use space characters.
-- @field v_scroll_bar (bool)
--   Whether the vertical scroll bar is visible.
--   Set to `false` to never see it and `true` to enable it again. The default
--   state is to display it when required.
-- @field view_eol (bool)
--   Whether the end of line characters are visible.
--   Normally, the end of line characters are hidden.
-- @field view_ws (number)
--   The visibility of white space characters.
--
--   * `_SCINTILLA.constants.SCWS_INVISIBLE` (0)
--     The normal display mode with white space displayed as an empty background
--     color.
--   * `_SCINTILLA.constants.SCWS_VISIBLEALWAYS` (1)
--     White space characters are drawn as dots and arrows.
--   * `_SCINTILLA.constants.SCWS_VISIBLEAFTERINDENT` (2)
--     White space used for indentation is displayed normally but after the
--     first visible character, it is shown as dots and arrows.
-- @field virtual_space_options (number)
--   Virtual space options.
--
--   * `_SCINTILLA.constants.SCVS_NONE` (0)
--     Disables all use of virtual space (default).
--   * `_SCINTILLA.constants.SCVS_RECTANGULARSELECTION` (1)
--     Enabled only for rectangular selections.
--   * `_SCINTILLA.constants.SCVS_USERACCESSIBLE` (2)
--     Enabled.
-- @field whitespace_chars (string, Write-only)
--   The set of characters making up whitespace for when moving or selecting by
--   word.
--   Use after setting `buffer.word_chars`.
-- @field wrap_indent_mode (number)
--   How wrapped sublines are placed.
--   Default is fixed.
--
--   * `_SCINTILLA.constants.SC_WRAP_INDENT_FIXED` (0)
--     Wrapped sublines aligned to left of window plus amount set by
--     `buffer.wrap_start_indent`.
--   * `_SCINTILLA.constants.SC_WRAP_INDENT_SAME` (1)
--     Wrapped sublines are aligned to first subline indent.
--   * `_SCINTILLA.constants.SC_WRAP_INDENT_INDENT` (2)
--     Wrapped sublines are aligned to first subline indent plus one more level
--     of indentation.
-- @field whitespace_size (number)
--   The size of the dots used to mark space characters.
-- @field word_chars (string)
--   The set of characters making up words when moving or selecting by word.
-- @field wrap_mode (number)
--   Text word wrap mode.
--
--   * `_SCINTILLA.constants.SC_WRAP_NONE` (0)
--     Disable line wrapping.
--   * `_SCINTILLA.constants.SC_WRAP_WORD` (1)
--     Enable wrapping on word boundaries.
--   * `_SCINTILLA.constants.SC_WRAP_CHAR` (2)
--     Enable wrapping between any characters.
-- @field wrap_start_indent (number)
--   The start indent for wrapped lines.
-- @field wrap_visual_flags (number)
--   The display mode of visual flags for wrapped lines.
--
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAG_NONE` (0)
--     No visual flags.
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAG_END` (1)
--     Visual flag at end of subline of a wrapped line.
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAG_START` (2)
--     Visual flag at begin of subline of a wrapped line.
--     Subline is indented by at least 1 to make room for the flag.
-- @field wrap_visual_flags_location (number)
--   The location of visual flags for wrapped lines.
--
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAGLOC_DEFAULT` (0)
--     Visual flags drawn near border.
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAGLOC_END_BY_TEXT` (1)
--     Visual flag at end of subline drawn near text.
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAGLOC_START_BY_TEXT` (2)
--     Visual flag at beginning of subline drawn near text.
-- @field x_offset (number)
--   The horizontal scroll position.
--   A value of `0` is the normal position with the first text column visible at
--   the left of the view.
-- @field zoom (number)
--   The number of points added to the size of all fonts.
--   It may be positive to magnify or negative to reduce.
module('buffer')

---
-- Add a selection from anchor to caret as the main selection.
-- Retainings all other selections as additional selections. Since there is
-- always at least one selection, to set a list of selections, the first
-- selection should be added with `buffer:set_selection()` and later selections
-- added with this function.
-- @param buffer The global buffer.
-- @param caret The caret.
-- @param anchor The anchor.
function buffer.add_selection(buffer, caret, anchor) end

---
-- Add text to the document at current position.
-- The current position is set at the end of the inserted text, but it is not
-- scrolled into view.
-- @param buffer The global buffer.
-- @param text The text to add.
function buffer.add_text(buffer, text) end

---
-- Enlarge the document to a particular size of text bytes.
-- The document will not be made smaller than its current contents.
-- @param buffer The global buffer.
-- @param bytes
function buffer.allocate(buffer, bytes) end

---
-- Clear the annotations from all lines.
-- @param buffer The global buffer.
function buffer.annotation_clear_all(buffer) end

---
-- Get the annotation text for a line.
-- @param buffer The global buffer.
-- @param line The line number.
-- @return string
function buffer.annotation_get_text(buffer, line) end

---
-- Set the annotation text for a line.
-- @param buffer The global buffer.
-- @param line The line number.
-- @param text The text.
function buffer.annotation_set_text(buffer, line, text) end

---
-- Append a string to the end of the document without changing the selection.
-- The current selection is not changed and the new text is not scrolled into
-- view.
-- @param buffer The global buffer.
-- @param text The text.
function buffer.append_text(buffer, text) end

---
-- Is there an auto-completion list visible?
-- @param buffer
-- @return bool
function buffer.auto_c_active(buffer) end

---
-- Remove the auto-completion list from the screen.
-- A set of characters that will cancel autocompletion can be specified with
-- `buffer:auto_c_stops()`.
-- @param buffer The global buffer.
function buffer.auto_c_cancel(buffer) end

---
-- User has selected an item so remove the list and insert the selection.
-- This has the same effect as the tab key.
-- @param buffer The global buffer.
function buffer.auto_c_complete(buffer) end

---
-- Get currently selected item position in the auto-completion list.
-- @param buffer The global buffer.
-- @return number
function buffer.auto_c_get_current(buffer) end

---
-- Get currently selected item text in the auto-completion list.
-- @param buffer The global buffer.
-- @return string
function buffer.auto_c_get_current_text(buffer) end

---
-- Retrieve the position of the caret when the auto-completion list was
-- displayed.
-- @param buffer The global buffer.
-- @return number
function buffer.auto_c_pos_start(buffer) end

---
-- Select the item in the auto-completion list that starts with a string.
-- By default, comparisons are case sensitive, but this can change with
-- `buffer.auto_c_ignore_case`.
-- @param buffer The global buffer.
-- @param string
function buffer.auto_c_select(buffer, string) end

---
-- Display an auto-completion list.
-- @param len_entered The number of characters before the caret used to provide
--   the context.
-- @param item_list List of words separated by separator characters (initially
--   spaces). The list of words should be in sorted order.
function buffer.auto_c_show(buffer, len_entered, item_list) end

---
-- Define a set of characters that when typed cancel the auto-completion list.
-- @param buffer The global buffer.
-- @param chars String list of characters. This list is empty by default.
function buffer.auto_c_stops(buffer, chars) end

---
-- Dedent the selected lines.
-- @param buffer The global buffer.
function buffer.back_tab(buffer) end

---
-- Start a sequence of actions that is undone and redone as a unit.
-- May be nested.
-- @param buffer The global buffer.
function buffer.begin_undo_action(buffer) end

---
-- Highlight the character at a position indicating there is no matching brace.
-- @param buffer The global buffer.
-- @param pos The position or -1 to remove the highlight.
function buffer.brace_bad_light(buffer, pos) end

---
-- Use specified indicator to highlight non matching brace instead of changing
-- its style.
-- @param buffer The global buffer.
-- @param use_indicator Use an indicator.
-- @param indic_num The indicator number.
function buffer.brace_bad_light_indicator(buffer, use_indicator, indic_num) end

---
-- Highlight the characters at two positions.
-- If indent guides are enabled, the indent that corresponds with the brace can
-- be highlighted by locating the column with `buffer.column` and highlight the
-- indent with `buffer.highlight_guide`.
-- @param buffer The global buffer.
-- @param pos1 The first position.
-- @param pos2 The second position.
function buffer.brace_highlight(buffer, pos1, pos2) end

---
-- Use specified indicator to highlight matching braces instead of changing
-- their style.
-- @param buffer The global buffer.
-- @param use_indicator Use an indicator.
-- @param indic_num The indicator number.
function buffer.brace_highlight_indicator(buffer, use_indicator, indic_num) end

---
-- Find the position of a matching brace or `-1` if no match.
-- The brace characters handled are `(`, `)`, `[`, `]`, `{`, `}`, `<`, and `>`.
-- The search is forwards from an opening brace and backwards from a closing
-- brace. A match only occurs if the style of the matching brace is the same as
-- the starting brace or the matching brace is beyond the end of styling. Nested
-- braces are handled correctly.
-- @param buffer The global buffer.
-- @param pos The position.
-- @return number.
function buffer.brace_match(buffer, pos) end

---
-- Is there an active call tip?
-- @param buffer The global buffer.
-- @return bool
function buffer.call_tip_active(buffer) end

---
-- Remove the call tip from the screen.
-- Call tips are also removed if any keyboard commands that are not compatible
-- with editing the argument list of a function are used.
-- @param buffer The global buffer.
function buffer.call_tip_cancel(buffer) end

---
-- Retrieve the position where the caret was before displaying the call tip.
-- @param buffer The global buffer.
-- @return number
function buffer.call_tip_pos_start(buffer) end

---
-- Highlights a segment of a call tip.
-- @param buffer The global buffer.
-- @param start_pos The start position.
-- @param end_pos The end position.
function buffer.call_tip_set_hlt(buffer, start_pos, end_pos) end

---
-- Show a call tip containing a definition near position pos.
-- The call tip text is aligned to start 1 line below this character unless up
-- and/or down arrows have been included in the call tip text in which case the
-- tip is aligned to the right-hand edge of the rightmost arrow. The assumption
-- is that the text starts with something like `"\001 1 of 3 \002"`.
-- @param buffer The global buffer.
-- @param pos The position.
-- @param text The text.
function buffer.call_tip_show(buffer, pos, text) end

---
-- Will a paste succeed?
-- @param buffer The global buffer.
-- @return bool
function buffer.can_paste(buffer) end

---
-- Are there any redoable actions in the undo history?
-- @param buffer The global buffer.
-- @return bool
function buffer.can_redo(buffer) end

---
-- Are there any undoable actions in the undo history?
-- @param buffer The global buffer.
-- @return bool
function buffer.can_undo(buffer) end

---
-- Cancel any modes such as call tip or auto-completion list display.
-- @param buffer The global buffer.
function buffer.cancel(buffer) end

---
-- Indicate that the internal state of a lexer has changed over a range and
-- therefore there may be a need to redraw.
-- @param buffer The global buffer.
-- @param start_pos The start position.
-- @param end_pos The end position.
function buffer.change_lexer_state(buffer, start_pos, end_pos) end

---
-- Move caret left one character.
-- @param buffer The global buffer.
function buffer.char_left(buffer) end

---
-- Move caret left one character extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.char_left_extend(buffer) end

---
-- Move caret left one character, extending rectangular selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.char_left_rect_extend(buffer) end

---
-- Find the position of a character from a point within the window.
-- @param buffer The global buffer.
-- @param x
-- @param y
-- @return number
function buffer.char_position_from_point(buffer, x, y) end

---
-- Find the position of a character from a point within the window.
-- Return `-1` if not close to text.
-- @param buffer The global buffer.
-- @param x
-- @param y
-- @return number
function buffer.char_position_from_point_close(buffer, x, y) end

---
-- Move caret right one character.
-- @param buffer The global buffer.
function buffer.char_right(buffer) end

---
-- Move caret right one character extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.char_right_extend(buffer) end

---
-- Move caret right one character, extending rectangular selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.char_right_rect_extend(buffer) end

---
-- Set the last x chosen value to be the caret x position.
-- The view remembers the x value of the last position horizontally moved to
-- explicitly by the user and this value is then used when moving vertically
-- such as by using the up and down keys. This function sets the current x
-- position of the caret as the remembered value.
-- @param buffer The global buffer.
function buffer.choose_caret_x(buffer) end

---
-- Clear the selection.
-- @param buffer The global buffer.
function buffer.clear(buffer) end

---
-- Delete all text in the document.
-- @param buffer The global buffer.
function buffer.clear_all(buffer) end

---
-- Drop all key mappings.
-- @param buffer The global buffer.
function buffer.clear_all_cmd_keys(buffer) end

---
-- Set all style bytes to `0`, remove all folding information.
-- @param buffer The global buffer.
function buffer.clear_document_style(buffer) end

---
-- Clear all the registered XPM images.
-- @param buffer The global buffer.
function buffer.clear_registered_images(buffer) end

---
-- Clear selections to a single empty stream selection.
-- @param buffer The global buffer.
function buffer.clear_selections(buffer) end

---
-- Colorise a segment of the document using the current lexing language.
-- @param buffer The global buffer.
-- @param start_pos The start position.
-- @param end_pos The end position or `-1` to style from `start_pos` to the end
--   of the document.
function buffer.colourise(buffer, start_pos, end_pos) end

---
-- Find the next line at or after line_start that is a contracted fold header
-- line.
-- Return `-1` when no more lines.
-- @param buffer The global buffer.
-- @param line_start The start line number.
-- @return number
function buffer.contracted_fold_next(buffer, line_start) end

---
-- Converts all line endings in the document to one mode.
-- @param buffer The global buffer.
-- @param mode The line ending mode. Valid values are:
--   `_SCINTILLA.constants.SC_EOL_CRLF` (0),
--   `_SCINTILLA.constants.SC_EOL_CR (1)`, or
--   `_SCINTILLA.constants.SC_EOL_LF (2)`.
function buffer.convert_eo_ls(buffer, mode) end

---
-- Copy the selection to the clipboard.
-- @param buffer The buffer
function buffer.copy(buffer) end

---
-- Copy the selection, if selection empty copy the line with the caret.
-- @param buffer The global buffer.
function buffer.copy_allow_line(buffer) end

---
-- Copy a range of text to the clipboard. Positions are clipped into the
-- document.
-- @param buffer The global buffer.
-- @param start_pos The start position.
-- @param end_pos The end position.
function buffer.copy_range(buffer, start_pos, end_pos) end

---
-- Copy argument text to the clipboard.
-- @param buffer The global buffer.
-- @param text The text.
function buffer.copy_text(buffer, text) end

---
-- Count characters between two positions.
-- @param start_pos
-- @param end_pos
-- @return number
function buffer.count_characters(buffer, start_pos, end_pos) end

---
-- Cut the selection to the clipboard.
-- @param buffer The global buffer.
function buffer.cut(buffer) end

---
-- Delete back from the current position to the start of the line.
-- @param buffer The global buffer.
function buffer.del_line_left(buffer) end

---
-- Delete forwards from the current position to the end of the line.
-- @param buffer The global buffer.
function buffer.del_line_right(buffer) end

---
-- Delete the word to the left of the caret.
-- @param buffer The global buffer.
function buffer.del_word_left(buffer) end

---
-- Delete the word to the right of the caret.
-- @param buffer The global buffer.
function buffer.del_word_right(buffer) end

---
-- Delete the word to the right of the caret, but not the trailing non-word
-- characters.
-- @param buffer The global buffer.
function buffer.del_word_right_end(buffer) end

---
-- Delete the selection or if no selection, the character before the caret.
-- @param buffer The global buffer.
function buffer.delete_back(buffer) end

---
-- Delete the selection or if no selection, the character before the caret.
-- Will not delete the character before at the start of a line.
function buffer.delete_back_not_line(buffer) end

---
-- Find the document line of a display line taking hidden lines into account.
-- @param buffer The global buffer.
-- @return number
function buffer.doc_line_from_visible(buffer) end

---
-- Move caret to last position in document.
-- @param buffer The global buffer.
function buffer.document_end(buffer) end

---
-- Move caret to last position in document extending selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.document_end_extend(buffer) end

---
-- Move caret to first position in document.
-- @param buffer The global buffer.
function buffer.document_start(buffer) end

---
-- Move caret to first position in document extending selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.document_start_extend(buffer) end

---
-- Switch from insert to overtype mode or the reverse.
-- @param buffer The global buffer.
function buffer.edit_toggle_overtype(buffer) end

---
-- Delete the undo history.
-- It also sets the save point to the start of the undo buffer, so the document
-- will appear to be unmodified.
-- @param buffer The global buffer.
function buffer.empty_undo_buffer(buffer) end

---
-- Translates a UTF8 string into the document encoding.
-- Return the length of the result in bytes. On error return `0`.
-- @param buffer The global buffer.
-- @param string The string.
-- @return number
function buffer.encoded_from_utf8(buffer, string) end

---
-- End a sequence of actions that is undone and redone as a unit.
-- @param buffer The global buffer.
function buffer.end_undo_action(buffer) end

---
-- Ensure a particular line is visible by expanding any header line hiding it.
-- @param buffer The global buffer.
-- @param line The line number.
function buffer.ensure_visible(buffer, line) end

---
-- Ensure a particular line is visible by expanding any header line hiding it.
-- Use the currently set visibility policy to determine which range to display.
-- @param buffer The global buffer.
-- @param line The line number.
function buffer.ensure_visible_enforce_policy(buffer, line) end

---
-- Find the position of a column on a line taking into account tabs and
-- multi-byte characters.
-- If beyond end of line, return line end position.
-- @param buffer The global buffer.
-- @param line The line number.
-- @param column The column number.
function buffer.find_column(buffer, line, column) end

---
-- Insert a Form Feed character.
-- @param buffer The global buffer.
function buffer.form_feed(buffer) end

---
-- Retrieve the text of the line containing the caret.
-- Also returns the index of the caret on the line.
-- @param buffer The global buffer.
-- @return string, number
function buffer.get_cur_line(buffer) end

---
-- Get the back color for active hotspots in 0xBBGGRR format.
-- @param buffer The global buffer.
-- @return number
function buffer.get_hotspot_active_back(buffer) end

---
-- Get the fore color for active hotspots.
-- @param buffer The global buffer.
-- @return number
function buffer.get_hotspot_active_fore(buffer) end

---
-- Find the last child line of a header line.
-- @param buffer The global buffer.
-- @param header_line The line number of a header line.
-- @param level The level or `-1` for the level of header_line.
function buffer.get_last_child(buffer, header_line, level) end

---
-- Retrieve the name of the lexer.
-- @param buffer The global buffer.
function buffer.get_lexer_language(buffer) end

---
-- Retrieve the contents of a line.
-- Also returns the length of the line.
-- @param buffer The global buffer.
-- @param line The line number.
-- @return string, number
function buffer.get_line(buffer, line) end

---
-- Retrieve the position of the end of the selection at the given line (`-1` if
-- no selection on this line).
-- @param buffer The global buffer.
-- @param line The line number.
function buffer.get_line_sel_end_position(buffer, line) end

---
-- Retrieve the position of the start of the selection at the given line (`-1`
-- if no selection on this line).
-- @param buffer The global buffer.
-- @param line The line number.
function buffer.get_line_sel_start_position(buffer, line) end

---
-- Retrieve a `property` value previously set with `buffer.property`.
-- @param buffer The global buffer.
-- @param key Keyword.
-- @return string
function buffer.get_property(buffer, key) end

---
-- Retrieve a `property` value previously set with `buffer.property`, with `$()`
-- variable replacement on returned buffer.
-- @param buffer The global buffer.
-- @param key Keyword.
-- @return string
function buffer.get_property_expanded(buffer, key) end

---
-- Retrieve the selected text.
-- Also returns the length of the text.
-- @param buffer The global buffer.
-- @return string, number
function buffer.get_sel_text(buffer) end

---
-- Retrieve the value of a tag from a regular expression search.
-- @param buffer The global buffer.
-- @param tag_num The tag number.
-- @return string
function buffer.get_tag(buffer, tag_num) end

---
-- Retrieve all the text in the document.
-- Also returns number of characters retrieved.
-- @param buffer The global buffer.
function buffer.get_text(buffer) end

---
-- Set caret to start of a line and ensure it is visible.
-- @param buffer The global buffer.
-- @param line The line number.
function buffer.goto_line(buffer, line) end

---
-- Set caret to a position and ensure it is visible.
-- The anchor position is set the same as the current position.
-- @param buffer The global buffer.
-- @param pos The position.
function buffer.goto_pos(buffer, pos) end

---
-- Set the focus to this view.
-- @param buffer The global buffer.
function buffer.grab_focus(buffer) end

---
-- Make a range of lines invisible.
-- This has no effect on fold levels or fold flags. `start_line` can not be
-- hidden.
-- @param buffer The global buffer.
-- @param start_line The start line.
-- @param end_line The end line.
function buffer.hide_lines(buffer, start_line, end_line) end

---
-- Draw the selection in normal style or with selection highlighted.
-- @param buffer The global buffer.
-- @param normal Draw normal selection.
function buffer.hide_selection(buffer, normal) end

---
-- Move caret to first position on line.
-- @param buffer The global buffer.
function buffer.home(buffer) end

---
-- Move caret to first position on display line.
-- @param buffer The global buffer.
function buffer.home_display(buffer) end

---
-- Move caret to first position on display line extending selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.home_display_extend(buffer) end

---
-- Move caret to first position on line extending selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.home_extend(buffer) end

---
-- Move caret to first position on line, extending rectangular selection to new
-- caret position.
-- @param buffer The global buffer.
function buffer.home_rect_extend(buffer) end

---
-- Move caret to the start of the display line when word-wrap is enabled.
-- If already there, go to the start of the document line.
-- @param buffer The global buffer.
function buffer.home_wrap(buffer) end

---
-- Like `buffer:home_wrap()` but extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.home_wrap_extend(buffer) end

---
-- Retrieve a bitmap value representing which indicators are non-zero at a
-- position.
-- Bit 0 is set if indicator 0 is present, bit 1 for indicator 1 and so on.
-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.indicator_all_on_for(buffer, pos) end

---
-- Turn a indicator off over a range.
-- @param buffer The global buffer.
-- @param pos The start position.
-- @param clear_length The length.
function buffer.indicator_clear_range(buffer, pos, clear_length) end

---
-- Find the position where a particular indicator ends.
-- @param buffer The global buffer.
-- @param indicator An indicator number in the range of `0` to `31`.
-- @param pos The position of the indicator.
function buffer.indicator_end(buffer, indicator, pos) end

---
-- Turn a indicator on over a range.
-- This function fills with the current indicator value.
-- @param buffer The global buffer.
-- @param pos the start position.
-- @param fill_length The length.
function buffer.indicator_fill_range(buffer, pos, fill_length) end

---
-- Find the position where a particular indicator starts.
-- @param buffer The global buffer.
-- @param indicator An indicator number in the range of `0` to `31`.
-- @param pos The position of the indicator.
function buffer.indicator_start(buffer, indicator, pos) end

---
-- Retrieve the value of a particular indicator at a position.
-- Currently all values are drawn the same.
-- @param buffer The global buffer.
-- @param indicator The indicator number in the range of `0` to `31`.
-- @param pos The position.
-- @return number
function buffer.indicator_value_at(buffer, indicator, pos) end

---
-- Insert string at a position.
-- If the current position is after the insertion point then it is moved along
-- with its surrounding text but no scrolling is performed.
-- @param buffer The global buffer.
-- @param pos The position to insert text at or `-1` for the current position.
-- @param text The text to insert.
function buffer.insert_text(buffer, pos, text) end

---
-- Copy the line containing the caret.
-- @param buffer The global buffer.
function buffer.line_copy(buffer) end

---
-- Cut the line containing the caret.
-- @param buffer The global buffer.
function buffer.line_cut(buffer) end

---
-- Delete the line containing the caret.
-- @param buffer The global buffer.
function buffer.line_delete(buffer) end

---
-- Move caret down one line.
-- @param buffer The global buffer.
function buffer.line_down(buffer) end

---
-- Move caret down one line extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.line_down_extend(buffer) end

---
-- Move caret down one line, extending rectangular selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.line_down_rect_extend(buffer) end

---
-- Duplicate the current line.
-- @param buffer The global buffer.
function buffer.line_duplicate(buffer) end

---
-- Move caret to last position on line.
-- @param buffer The global buffer.
function buffer.line_end(buffer) end

---
-- Move caret to last position on display line.
-- @param buffer The global buffer.
function buffer.line_end_display(buffer) end

---
-- Move caret to last position on display line extending selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.line_end_display_extend(buffer) end

---
-- Move caret to last position on line extending selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.line_end_extend(buffer) end

---
-- Move caret to last position on line, extending rectangular selection to new
-- caret position.
-- @param buffer The global buffer.
function buffer.line_end_rect_extend(buffer) end

---
-- Move caret to the end of the display line when word-wrap is enabled.
-- If already there, go to the end of the document line.
-- @param buffer The global buffer.
function buffer.line_end_wrap(buffer) end

---
-- Like `buffer:line_end_wrap()` but extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.line_end_wrap_extend(buffer) end

---
-- Retrieve the line containing a position.
-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.line_from_position(buffer, pos) end

---
-- Returns how many characters are on a line, including end of line characters.
-- To get the length of the line not including any end of line characters, use
-- `buffer.line_end_position[line] - buffer:position_from_line(line)`.
-- @param buffer The global buffer.
-- @param line The line number.
-- @return number
function buffer.line_length(buffer, line) end

---
-- Scroll horizontally and vertically.
-- @param buffer The global buffer.
-- @param columns The number of columns to scroll horizontally.
-- @param lines The number of lines to scroll vertically.
function buffer.line_scroll(buffer, columns, lines) end

---
-- Scroll the document down, keeping the caret visible.
-- @param buffer The global buffer.
function buffer.line_scroll_down(buffer) end

---
-- Scroll the document up, keeping the caret visible.
-- @param buffer The global buffer.
function buffer.line_scroll_up(buffer) end

---
-- Switch the current line with the previous.
-- @param buffer The global buffer.
function buffer.line_transpose(buffer) end

---
-- Move caret up one line.
-- @param buffer The global buffer.
function buffer.line_up(buffer) end

---
-- Move caret up one line extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.line_up_extend(buffer) end

---
-- Move caret up one line, extending rectangular selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.line_up_rect_extend(buffer) end

---
-- Join the lines in the target.
-- Where this would lead to no space between words, an extra space is inserted.
-- @param buffer The global buffer.
function buffer.lines_join(buffer) end

---
-- Split the lines in the target into lines that are less wide than
-- `pixel_width` where possible.
-- @param buffer The global buffer.
-- @param pixel_width The pixel width. When `0`, the width of the view is used.
function buffer.lines_split(buffer, pixel_width) end

---
-- Transform the selection to lower case.
-- @param buffer The global buffer.
function buffer.lower_case(buffer) end

---
-- Get the text in the text margin for a line.
-- @param buffer The global buffer.
-- @param line The line number.
-- @return string
function buffer.margin_get_text(buffer, line) end

---
-- Set the text in the text margin for a line.
-- @param buffer The global buffer.
-- @param line The line number.
-- @param text The text.
function buffer.margin_set_text(buffer, line, text) end

---
-- Clear the margin text on all lines.
-- @param buffer The global buffer.
function buffer.margin_text_clear_all(buffer) end

---
-- Add a marker to a line, returning an ID which can be used to find or delete
-- the marker.
-- Returns `-1` if this fails (illegal line number, out of memory).
-- @param buffer The global buffer.
-- @param line The line number.
-- @param marker_num A marker number in the range of `0` to `31`.
-- @return number
function buffer.marker_add(buffer, line, marker_num) end

---
-- Add a set of markers to a line.
-- @param buffer The global buffer.
-- @param line The line number.
-- @param marker_mask A mask of markers to set. Set bit 0 to set marker 0, bit
--   1 for marker 1 and so on.
function buffer.marker_add_set(buffer, line, marker_mask) end

---
-- Set the symbol used for a particular marker number.
-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of `0` to `31`.
-- @param marker_symbol A marker symbol: `_SCINTILLA.constants.SC_MARK_*`.
-- @see _SCINTILLA.next_marker_number
function buffer.marker_define(buffer, marker_num, marker_symbol) end

---
-- Define a marker from a pixmap.
-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of `0` to `31`.
-- @param pixmap `NULL`-terminated pixmap data.
function buffer.marker_define_pixmap(buffer, marker_num, pixmap) end

---
-- Define a marker from RGBA data.
-- It has the width and height from `buffer.rgba_image_width` and
-- `buffer.rgba_image_height`.
-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of `0` to `31`.
-- @param pixels A sequence of 4 byte pixel values starting with the pixels for
--   the top line, with the leftmost pixel first, then continuing with the
--   pixels for subsequent lines. There is no gap between lines for alignment
--   reasons. Each pixel consists of, in order, a red byte, a green byte, a blue
--   byte and an alpha byte. The colour bytes are not premultiplied by the alpha
--   value. That is, a fully red pixel that is 25% opaque will be `[FF, 00, 00,
--   3F]`.
function buffer.marker_define_rgba_image(buffer, marker_num, pixels) end

---
-- Delete a marker from a line.
-- @param buffer The global buffer.
-- @param line The line number.
-- @param marker_num A marker number in the range of `0` to `31` or `-1` to
--   delete all markers from the line.
function buffer.marker_delete(buffer, line, marker_num) end

---
-- Delete all markers with a particular number from all lines.
-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of `0` to `31` or `-1` to
--   delete all markers from the line.
function buffer.marker_delete_all(buffer, marker_num) end

---
-- Delete a marker.
-- @param buffer The global buffer.
-- @param handle The identifier of a marker returned by `buffer:marker_add()`.
function buffer.marker_delete_handle(buffer, handle) end

---
-- Enable/disable highlight for current folding block (smallest one that
-- contains the caret)
-- @param buffer The global buffer.
-- @param enabled
function buffer.marker_enable_highlight(buffer, enabled) end

---
-- Get a bit mask of all the markers set on a line.
-- Bit 0 is set if marker 0 is present, bit 1 for marker 1 and so on.
-- @param buffer The global buffer.
-- @param line The line number.
-- @return number.
function buffer.marker_get(buffer, line) end

---
-- Retrieve the line number at which a particular marker is located.
-- Returns `-1` if it not found.
-- @param buffer The global buffer.
-- @param handle The identifier of a marker returned by `buffer:marker_add()`.
-- @return number
function buffer.marker_line_from_handle(buffer, handle) end

---
-- Find the next line at or after start_line that includes a marker in mask.
-- Return `-1` when no more lines.
-- @param buffer The global buffer.
-- @param start_line The start line.
-- @param marker_mask A mask of markers to find. Set bit 0 to find marker 0, bit
--   1 for marker 1 and so on.
-- @return number
function buffer.marker_next(buffer, start_line, marker_mask) end

---
-- Find the previous line before `start_line` that includes a marker in mask.
-- @param buffer The global buffer.
-- @param start_line The start line.
-- @param marker_mask A mask of markers to find. Set bit 0 to find marker 0, bit
--   1 for marker 1 and so on.
-- @return number
function buffer.marker_previous(buffer, start_line, marker_mask) end

---
-- Set the alpha used for a marker that is drawn in the text area, not the
-- margin.
-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of `0` to `31`.
-- @param alpha An alpha value between `0` (transparent) and `255` (opaque), or
--   `256` for no alpha.
function buffer.marker_set_alpha(buffer, marker_num, alpha) end

---
-- Set the background color used for a particular marker number.
-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of `0` to `31`.
-- @param color A color in `0xBBGGRR` format.
function buffer.marker_set_back(buffer, marker_num, color) end

---
-- Set the background color used for a particular marker number when its
-- folding block is selected.
-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of `0` to `31`.
-- @param color A color in `0xBBGGRR` format. The default color is `#FF0000`.
function buffer.marker_set_back_selected(buffer, marker_num, color) end

---
-- Set the foreground color used for a particular marker number.
-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of `0` to `31`.
-- @param color A color in `0xBBGGRR` format.
function buffer.marker_set_fore(buffer, marker_num, color) end

---
-- Return the symbol defined for marker_num with `buffer:marker_define()`.
-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of `0` to `31`.
-- @return number
function buffer.marker_symbol_defined(buffer, marker_num) end

---
-- Move the caret inside current view if it is not there already.
-- Any selection is lost.
-- @param buffer The global buffer.
function buffer.move_caret_inside_view(buffer) end

---
-- Move the selected lines down one line, shifting the line below before the
-- selection.
-- The selection will be automatically extended to the beginning of the
-- selection's first line and the end of the seletion's last line. If nothing
-- was selected, the line the cursor is currently at will be selected.
-- @param buffer The global buffer.
function buffer.move_selected_lines_down(buffer) end

---
-- Move the selected lines up one line, shifting the line above after the
-- selection.
-- The selection will be automatically extended to the beginning of the
-- selection's first line and the end of the seletion's last line. If nothing
-- was selected, the line the cursor is currently at will be selected.
-- @param buffer The global buffer.
function buffer.move_selected_lines_up(buffer) end

---
-- Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
-- @param buffer The global buffer.
function buffer.new_line(buffer) end

---
-- Move caret one page down.
-- @param buffer The global buffer.
function buffer.page_down(buffer) end

---
-- Move caret one page down extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.page_down_extend(buffer) end

---
-- Move caret one page down, extending rectangular selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.page_down_rect_extend(buffer) end

---
-- Move caret one page up.
-- @param buffer The global buffer.
function buffer.page_up(buffer) end

---
-- Move caret one page up extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.page_up_extend(buffer) end

---
-- Move caret one page up, extending rectangular selection to new caret
-- position.
-- @param buffer The global buffer.
function buffer.page_up_rect_extend(buffer) end

---
-- Move caret one paragraph down (delimited by empty lines).
-- @param buffer The global buffer.
function buffer.para_down(buffer) end

---
-- Move caret one paragraph down (delimited by empty lines) extending selection
-- to new caret position.
-- @param buffer The global buffer.
function buffer.para_down_extend(buffer) end

---
-- Move caret one paragraph up (delimited by empty lines).
-- @param buffer The global buffer.
function buffer.para_up(buffer) end

---
-- Move caret one paragraph up (delimited by empty lines) extending selection to
-- new caret position.
-- @param buffer The global buffer.
function buffer.para_up_extend(buffer) end

---
-- Paste the contents of the clipboard into the document replacing the
-- selection.
-- @param buffer The global buffer.
function buffer.paste(buffer) end

---
-- For private communication between an application and a known lexer.
-- @param buffer The global buffer.
-- @param operation An operation number.
-- @param data Number data.
function buffer.private_lexer_call(buffer, operation, data) end

---
-- Retrieve the x value of the point in the window where a position is
-- displayed.
-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.point_x_from_position(buffer, pos) end

---
-- Retrieve the y value of the point in the window where a position is
-- displayed.
-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.point_y_from_position(buffer, pos) end

---
-- Given a valid document position, return the next position taking code page
-- into account. Maximum value returned is the last position in the document.
-- @param buffer The global buffer.
-- @param pos The position.
function buffer.position_after(buffer, pos) end

---
-- Given a valid document position, return the previous position taking code
-- page into account. Returns `0` if passed `0`.
-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.position_before(buffer, pos) end

---
-- Retrieve the position at the start of a line.
-- If line is greater than the lines in the document, returns `-1`.
-- @param buffer The global buffer.
-- @param line The line.
-- @return number
function buffer.position_from_line(buffer, line) end

---
-- Find the position from a point within the window.
-- @param buffer The global buffer.
-- @param x
-- @param y
-- @return number
function buffer.position_from_point(buffer, x, y) end

---
-- Returns the position from a point within the window, but return `-1` if not
-- close to text.
-- @param buffer The global buffer.
-- @param x
-- @param y
-- @return number
function buffer.position_from_point_close(buffer, x, y) end

---
-- Redoes the next action on the undo history.
-- @param buffer The global buffer.
function buffer.redo(buffer) end

---
-- Register an XPM image for use in autocompletion lists.
-- @param buffer The global buffer.
-- @param type Integer type to register the image with.
-- @param xpm_data XPM data as is described for `buffer:marker_define_pixmap()`.
function buffer.register_image(buffer, type, xpm_data) end

---
-- Register an RGBA image for use in autocompletion lists.
-- It has the width and height from `buffer.rgba_image_width` and
-- `buffer.rgba_image_height`.
-- @param buffer The global buffer.
-- @param type Integer type to register the image with.
-- @param pixels RGBA data as is described for
--   `buffer:marker_define_rgba_image()`.
function buffer.register_rgba_image(buffer, type, pixels) end

---
-- Replace the selected text with the argument text.
-- The caret is positioned after the inserted text and the caret is scrolled
-- into view.
-- @param buffer The global buffer.
-- @param text The text.
function buffer.replace_sel(buffer, text) end

---
-- Replace the target text with the argument text.
-- After replacement, the target range refers to the replacement text.
-- Returns the length of the replacement text.
-- @param buffer The global buffer.
-- @param text The text (can contain NULs).
-- @return number
function buffer.replace_target(buffer, text) end

---
-- Replace the target text with the argument text after `\d` processing.
-- Looks for `\d` where `d` is between `1` and `9` and replaces these with the
-- strings matched in the last search operation which were surrounded by `\(`
-- and `\)`. Returns the length of the replacement text including any change
-- caused by processing the `\d` patterns.
-- @param buffer The global buffer.
-- @param text The text (can contain NULs).
-- @return number
function buffer.replace_target_re(buffer, text) end

---
-- Set the main selection to the next selection.
-- @param buffer The global buffer.
function buffer.rotate_selection(buffer) end

---
-- Ensure the caret is visible.
-- @param buffer The global buffer.
function buffer.scroll_caret(buffer) end

---
-- Scroll to end of document.
-- @param buffer The global buffer.
function buffer.scroll_to_end(buffer) end

---
-- Scroll to start of document.
-- @param buffer The global buffer.
function buffer.scroll_to_start(buffer) end

---
-- Sets the current caret position to be the search anchor.
-- Always call this before calling either of `buffer:search_next()` or
-- `buffer:search_prev()`.
-- @param buffer The global buffer.
function buffer.search_anchor(buffer) end

---
-- Search for a counted string in the target and set the target to the found
-- range.
-- Returns length of range or `-1` for failure in which case target is not
-- moved.
-- @param buffer The global buffer.
-- @param text The text (can contain NULs).
-- @return number
function buffer.search_in_target(buffer, text) end

---
-- Find some text starting at the search anchor.
-- The return value is `-1` if nothing is found, otherwise the return value is
-- the start position of the matching text. The selection is updated to show the
-- matched text, but is not scrolled into view.
-- @param buffer The global buffer.
-- @param flags Search flags. See `buffer.search_flags`.
-- @param text The text.
-- @return number
function buffer.search_next(buffer, flags, text) end

---
-- Find some text starting at the search anchor and moving backwards.
-- The return value is `-1` if nothing is found, otherwise the return value is
-- the start position of the matching text. The selection is updated to show the
-- matched text, but is not scrolled into view.
-- @param buffer The global buffer.
-- @param flags Search flags. See `buffer.search_flags`.
-- @param text The text.
-- @return number
function buffer.search_prev(buffer, flags, text) end

---
-- Select all the text in the document.
-- The current position is not scrolled into view.
-- @param buffer The global buffer.
function buffer.select_all(buffer) end

---
-- Duplicate the selection.
-- If selection empty duplicate the line containing the caret.
-- @param buffer The global buffer.
function buffer.selection_duplicate(buffer) end

---
-- Reset the set of characters for whitespace and word characters to the
-- defaults.
-- This sets whitespace to space, tab and other characters with codes less than
-- `0x20`, with word characters set to alphanumeric and `'_'`.
-- @param buffer The global buffer.
function buffer.set_chars_default(buffer) end

---
-- Set caret to a position, while removing any existing selection.
-- The caret is not scrolled into view.
-- @param buffer The buffer
-- @param pos The position to move to.
function buffer.set_empty_selection(buffer, pos) end

---
-- Set some style options for folding.
-- @param buffer The global buffer.
-- @param flags Mask of fold flags. Flags available are
--   `_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_EXPANDED` (2): Draw above if
--   expanded; `_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_CONTRACTED` (4):
--   Draw above if not expanded;
--   `_SCINTILLA.constants.SC_FOLDFLAG_LINEAFTER_EXPANDED` (8): Draw below if
--   expanded; `_SCINTILLA.constants.SC_FOLDFLAG_LINEAFTER_CONTRACTED` (16):
--   Draw below if not expanded
function buffer.set_fold_flags(buffer, flags) end

---
-- Set the colors used as a chequerboard pattern in the fold margin.
-- @param buffer The global buffer.
-- @param use_setting Enable color change.
-- @param color A color in `0xBBGGRR` format.
function buffer.set_fold_margin_colour(buffer, use_setting, color) end

---
-- Set the colors used as a checkerboard pattern in the fold margin.
-- @param buffer The global buffer.
-- @param use_setting Enable color change.
-- @param color A color in `0xBBGGRR` format.
function buffer.set_fold_margin_hi_colour(buffer, use_setting, color) end

---
-- Set a back color for active hotspots.
-- @param buffer The global buffer.
-- @param use_setting Enable the color change.
-- @param color A color in `0xBBGGRR` format.
function buffer.set_hotspot_active_back(buffer, use_setting, color) end

---
-- Set a fore color for active hotspots.
-- @param buffer The global buffer.
-- @param use_setting Enable the color change.
-- @param color A color in `0xBBGGRR` format.
function buffer.set_hotspot_active_fore(buffer, use_setting, color) end

---
-- Set the length of the utf8 argument for calling `buffer:encoded_from_utf8()`.
-- @param buffer The global buffer.
-- @param bytes Bytes or `-1` for measuring to first NUL.
function buffer.set_length_for_encode(buffer, bytes) end

---
-- Set the lexing language of the document based on string name.
-- @param buffer The global buffer.
-- @param language_name The language name.
function buffer.set_lexer_language(buffer, language_name) end

---
-- Remember the current position in the undo history as the position at which
-- the document was saved.
-- @param buffer The global buffer.
function buffer.set_save_point(buffer) end

---
-- Select a range of text.
-- The caret is scrolled into view after this operation.
-- @param buffer The global buffer.
-- @param start_pos Start position. If negative, it means the end of the
--   document.
-- @param end_pos End position. If negative, it means remove any selection (i.e.
--   set the `anchor` to the same position as `current_pos`).
function buffer.set_sel(buffer, start_pos, end_pos) end

---
-- Set the background color of the main and additional selections and whether to
-- use this setting.
-- @param buffer The global buffer.
-- @param use_setting Enable color change.
-- @param color A color in `0xBBGGRR` format.
function buffer.set_sel_back(buffer, use_setting, color) end

---
-- Set the foreground color of the main and additional selections and whether
-- to use this setting.
-- @param buffer The global buffer.
-- @param use_setting Enable color change.
-- @param color A color in `0xBBGGRR` format.
function buffer.set_sel_fore(buffer, use_setting, color) end

---
-- Set a simple selection from anchor to caret.
-- @param buffer The global buffer.
-- @param caret The caret.
-- @param anchor The anchor.
function buffer.set_selection(buffer, caret, anchor) end

---
-- Change style from current styling position for length characters to a style
-- and move the current styling position to after this newly styled segment.
-- @param buffer The global buffer.
-- @param length The length to style.
-- @param style The style number to set.
function buffer.set_styling(buffer, length, style) end

---
-- Replace the contents of the document with the argument text.
-- @param buffer The global buffer.
-- @param text The text.
function buffer.set_text(buffer, text) end

---
-- Set the way the display area is determined when a particular line is to be
-- moved to by `buffer:goto_line()`, etc.
-- It is similar in operation to `buffer:set_y_caret_policy()`.
-- @param buffer The global buffer.
-- @param visible_policy A combination of `_SCINTILLA.constants.VISIBLE_SLOP`,
--   (0x01) and `_SCINTILLA.constants.VISIBLE_STRICT` (0x04).
-- @param visible_slop The slop value.
function buffer.set_visible_policy(buffer, visible_policy, visible_slop) end

---
-- Set the background color of all whitespace and whether to use this setting.
-- @param buffer The global buffer.
-- @param use_setting Enable color change.
-- @param color A color in `0xBBGGRR` format.
function buffer.set_whitespace_back(buffer, use_setting, color) end

---
-- Set the foreground color of all whitespace and whether to use this setting.
-- @param buffer The global buffer.
-- @param use_setting Enable color change.
-- @param color A color in `0xBBGGRR` format.
function buffer.set_whitespace_fore(buffer, use_setting, color) end

---
-- Set the way the caret is kept visible when going sideway.
-- The exclusion zone is given in pixels.
-- @param buffer The global buffer.
-- @param caret_policy A combination of `_SCINTILLA.constants.CARET_SLOP`
--   (0x01), `_SCINTILLA.constants.CARET_STRICT` (0x04),
--   `_SCINTILLA.constants.CARET_JUMPS` (0x10), and
--   `_SCINTILLA.constants.CARET_EVEN` (0x08).
-- @param caret_slop A slop value.
function buffer.set_x_caret_policy(buffer, caret_policy, caret_slop) end

---
-- Set the way the line the caret is on is kept visible.
-- @param buffer The global buffer.
-- @param caret_policy A combination of `_SCINTILLA.constants.CARET_SLOP`
--   (0x01), `_SCINTILLA.constants.CARET_STRICT` (0x04),
--   `_SCINTILLA.constants.CARET_JUMPS` (0x10), and
--   `_SCINTILLA.constants.CARET_EVEN` (0x08).
-- @param caret_slop A slop value.
function buffer.set_y_caret_policy(buffer, caret_policy, caret_slop) end

---
-- Make a range of lines visible.
-- This has no effect on fold levels or fold flags. `start_line` can not be
-- hidden.
-- @param buffer The global buffer.
-- @param start_line The start line.
-- @param end_line The end line.
function buffer.show_lines(buffer, start_line, end_line) end

---
-- Start notifying the container of all key presses and commands.
-- @param buffer The global buffer.
function buffer.start_record(buffer) end

---
-- Set the current styling position to pos and the styling mask to mask.
-- The styling mask can be used to protect some bits in each styling byte from
-- modification.
-- @param buffer The global buffer.
-- @param position The styling position.
-- @param mask The bit mask of the style bytes that can be set.
function buffer.start_styling(buffer, position, mask) end

---
-- Stop notifying the container of all key presses and commands.
-- @param buffer The global buffer.
function buffer.stop_record(buffer) end

---
-- Move caret to bottom of page, or one page down if already at bottom of page.
-- @param buffer The global buffer.
function buffer.stuttered_page_down(buffer) end

---
-- Move caret to bottom of page, or one page down if already at bottom of page,
-- extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.stuttered_page_down_extend(buffer) end

---
-- Move caret to top of page, or one page up if already at top of page.
-- @param buffer The global buffer.
function buffer.stuttered_page_up(buffer) end

---
-- Move caret to top of page, or one page up if already at top of page,
-- extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.stuttered_page_up_extend(buffer) end

---
-- Clear all the styles and make equivalent to the global default style.
-- @param buffer The global buffer.
function buffer.style_clear_all(buffer) end

---
-- Returns the font name of a given style.
-- @param buffer The global buffer.
-- @param style_num The style number.
-- @return string
function buffer.style_get_font(buffer, style_num) end

---
-- Reset the default style to its state at startup.
-- @param buffer The global buffer.
function buffer.style_reset_default(buffer) end

---
-- Swap that caret and anchor of the main selection.
-- @param buffer The global buffer.
function buffer.swap_main_anchor_caret(buffer) end

---
-- If selection is empty or all on one line replace the selection with a tab
-- character, or if more than one line selected, indent the lines.
-- @param buffer The global buffer.
function buffer.tab(buffer) end

---
-- Returns the target converted to UTF8.
-- @param buffer The global buffer.
function buffer.target_as_utf8(buffer) end

---
-- Make the target range start and end be the same as the selection range start
-- and end.
-- @param buffer The global buffer.
function buffer.target_from_selection(buffer) end

---
-- Retrieve the height of a particular line of text in pixels.
-- @param buffer The global buffer.
-- @param line The line number.
-- @return number
function buffer.text_height(buffer, line) end

---
-- Measure the pixel width of some text in a particular style.
-- Does not handle tab or control characters.
-- @param buffer The global buffer.
-- @param style_num The style number between `0` and `255`.
-- @param text The text.
-- @return number
function buffer.text_width(buffer, style_num, text) end

---
-- Switch between sticky and non-sticky: meant to be bound to a key.
-- See `buffer.caret_sticky`.
-- @param buffer The global buffer.
function buffer.toggle_caret_sticky(buffer) end

---
-- Switch a header line between expanded and contracted.
-- @param buffer The global buffer.
-- @param line The line number.
function buffer.toggle_fold(buffer, line) end

---
-- Undo one action in the undo history.
-- @param buffer The global buffer.
function buffer.undo(buffer) end

---
-- Transform the selection to upper case.
-- @param buffer The global buffer.
function buffer.upper_case(buffer) end

---
-- Sets whether a pop up menu is displayed automatically when the user presses
-- the wrong mouse button.
-- @param buffer The global buffer.
-- @param allow_popup Allow popup menu.
function buffer.use_pop_up(buffer, allow_popup) end

---
-- Display a list of strings and send notification when user chooses one.
-- @param buffer The global buffer.
-- @param list_type A list identifier number greater than zero.
-- @param item_list List of words separated by separator characters (initially
--   spaces).
-- @see _SCINTILLA.next_user_list_type
function buffer.user_list_show(buffer, list_type, item_list) end

---
-- Move caret to before first visible character on line.
-- If already there move to first character on line.
-- @param buffer The global buffer.
function buffer.vc_home(buffer) end

---
-- Like `buffer:vc_home()` but extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.vc_home_extend(buffer) end

---
-- Move caret to before first visible character on line.
-- If already there move to first character on line. In either case, extend
-- rectangular selection to new caret position.
-- @param buffer The global buffer.
function buffer.vc_home_rect_extend(buffer) end

---
-- Move caret to before first visible character on display line when word-wrap
-- is enabled.
-- If already there, go to first character on display line.
-- @param buffer The global buffer.
function buffer.vc_home_wrap(buffer) end

---
-- Like `buffer:vc_home_wrap()` but extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.vc_home_wrap_extend(buffer) end

---
-- Center current line in window.
-- @param buffer The global buffer.
function buffer.vertical_centre_caret(buffer) end

---
-- Find the display line of a document line taking hidden lines into account.
-- If there is folding and line is outside the range of lines in the document,
-- the return value is `-1`.
-- @param buffer The global buffer.
-- @param line The line number.
-- @return number
function buffer.visible_from_doc_line(buffer, line) end

---
-- Get position of end of word.
-- @param buffer The global buffer.
-- @param pos The position.
-- @param only_word_chars If `true`, stops searching at the first non-word
--   character in the search direction. Otherwise, the first character in the
--   search direction sets the type of the search as word or non-word and the
--   search stops at the first non-matching character. Searches are also
--   terminated by the start or end of the document.
function buffer.word_end_position(buffer, pos, only_word_chars) end

---
-- Move caret left one word.
-- @param buffer The global buffer.
function buffer.word_left(buffer) end

---
-- Move caret left one word, position cursor at end of word.
-- @param buffer The global buffer.
function buffer.word_left_end(buffer) end

---
-- Move caret left one word, position cursor at end of word, extending selection
-- to new caret position.
-- @param buffer The global buffer.
function buffer.word_left_end_extend(buffer) end

---
-- Move caret left one word extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.word_left_extend(buffer) end

---
-- Move to the previous change in capitalisation or underscores.
-- @param buffer The global buffer.
function buffer.word_part_left(buffer) end

---
-- Move to the previous change in capitalisation or underscores extending
-- selection to new caret position.
-- @param buffer The global buffer.
function buffer.word_part_left_extend(buffer) end

---
-- Move to the next change in capitalisation or underscores.
-- @param buffer The global buffer.
function buffer.word_part_right(buffer) end

---
-- Move to the next change in capitalisation or underscores extending selection
-- to new caret position.
-- @param buffer The global buffer.
function buffer.word_part_right_extend(buffer) end

---
-- Move caret right one word.
-- @param buffer The global buffer.
function buffer.word_right(buffer) end

---
-- Move caret right one word, position cursor at end of word.
-- @param buffer The global buffer.
function buffer.word_right_end(buffer) end

---
-- Move caret right one word, position cursor at end of word, extending
-- selection to new caret position.
-- @param buffer The global buffer.
function buffer.word_right_end_extend(buffer) end

---
-- Move caret right one word extending selection to new caret position.
-- @param buffer The global buffer.
function buffer.word_right_extend(buffer) end

---
-- Get position of start of word.
-- @param buffer The global buffer.
-- @param pos The position.
-- @param only_word_chars If `true`, stops searching at the first non-word
--   character in the search direction. Otherwise, the first character in the
--   search direction sets the type of the search as word or non-word and the
--   search stops at the first non-matching character. Searches are also
--   terminated by the start or end of the document.
function buffer.word_start_position(buffer, pos, only_word_chars) end

---
-- Returns the number of display lines needed to wrap a document line.
-- @param buffer The global buffer.
-- @param line The line number.
-- @return number
function buffer.wrap_count(buffer, line) end

---
-- Magnify the displayed text by increasing the sizes by 1 point if the current
-- zoom factor is less than 20 points.
-- @param buffer The global buffer.
function buffer.zoom_in(buffer) end

---
-- Make the displayed text smaller by decreasing the sizes by 1 point if the
-- current zoom factor is greater than -10 points.
-- @param buffer The global buffer.
function buffer.zoom_out(buffer) end

-- External functions.

---
-- Checks whether the given buffer is the global one.
-- If not, throws an error indicating so. It is necessary to call this at the
-- top of all buffer functions to avoid unexpected behavior since most buffer
-- functions operate on `_G.buffer`, which is not necessarily the given one.
-- @param buffer The buffer to check.
function buffer.check_global(buffer) end

---
-- Deletes the current buffer.
-- WARNING: this function should NOT be called via scripts. Use `buffer:close()`
-- instead, which prompts for confirmation if necessary. Generates a
-- `BUFFER_DELETED` event.
-- @param buffer The global buffer.
function buffer.delete(buffer) end

---
-- Gets a range of text from the current buffer.
-- @param buffer The global buffer.
-- @param start_pos The beginning position of the range of text to get.
-- @param end_pos The end position of the range of text to get.
function buffer.text_range(buffer, start_pos, end_pos) end

---
-- Reloads the file in a given buffer.
-- @param buffer The global buffer.
function buffer.reload(buffer) end

---
-- Sets the encoding for the buffer, converting its contents in the process.
-- @param buffer The global buffer.
-- @param encoding The encoding to set. Valid encodings are ones that GTK's
--   `g_convert()` function accepts (typically GNU iconv's encodings).
-- @usage buffer.set_encoding(buffer, 'ASCII')
function buffer.set_encoding(buffer, encoding) end

---
-- Saves the current buffer to a file.
-- @param buffer The global buffer.
function buffer.save(buffer) end

---
-- Saves the current buffer to a file different than its filename property.
-- @param buffer The global buffer.
-- @param utf8_filename The new filepath to save the buffer to. Must be UTF-8
--   encoded.
function buffer.save_as(buffer, utf8_filename) end

---
-- Closes the current buffer.
-- @param buffer The global buffer.
-- If the buffer is dirty, the user is prompted to continue. The buffer is not
-- saved automatically. It must be done manually.
function buffer.close(buffer) end

---
-- Replacement for `buffer.set_lexer_language(buffer)`.
-- Sets a `buffer._lexer` field so it can be restored without querying the
-- mime-types tables. Also if the user manually sets the lexer, it should be
-- restored.
-- Loads the language-specific module if it exists.
-- This function is added by `_M.textadept.mime_types`.
-- @param buffer The global buffer.
-- @param lang The string language to set.
-- @usage buffer.set_lexer(buffer, 'language_name')
function buffer.set_lexer(buffer, lang) end

---
-- Replacement for `buffer.get_lexer_language(buffer)`.
-- @param buffer The global buffer.
-- @param current Whether to get the lexer at the current caret position in
--   multi-language lexers. The default is `false` and returns the parent lexer.
function buffer.get_lexer(buffer, current) end

---
-- Returns the name of the style associated with a style number.
-- @param buffer The global buffer.
-- @param style_num A style number from `0` to `255`.
-- @see buffer.style_at
function buffer.get_style_name(buffer, style_num) end

-- Unused Fields.
--   * use_palette
--   * doc_pointer
--   * mod_event_mask
--   * paste_convert_endings
--   * character_pointer
--   * identifier
--   * key_words
--   * technology

-- Unused Functions.
--   * add_styled_text
--   * get_styled_text
--   * assign_cmd_key
--   * clear_cmd_key
--   * set_styling_ex
--   * find_text
--   * format_range
--   * null
--   * create_document
--   * add_ref_document
--   * release_document
--   * margin_set_styles
--   * margin_get_styles
--   * annotation_set_styles
--   * annotation_get_styles
--   * add_undo_action
--   * load_lexer_library
--   * property_names
--   * property_type
--   * describe_property
--   * describe_key_word_sets
--   * create_loader