aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/.buffer.luadoc
blob: 73a457c347d315495c83753a4f42965839575152 (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
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
-- 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.

---
-- A Textadept buffer object.
-- Be careful when storing references to a buffer object because if you attempt
-- call a buffer function with a non-global buffer, you will get an error. See
-- [`check_global()`](#check_global) for more information.
--
-- [buffer]: _G.html#buffer
-- @field additional_caret_fore (number)
--   The foreground color, in "0xBBGGRR" format, of additional carets.
-- @field additional_carets_blink (bool)
--   Allow additional carets to blink.
--   The default value is `true`.
-- @field additional_carets_visible (bool)
--   Display additional carets.
--   The default value is `true`.
-- @field additional_sel_alpha (number)
--   The alpha value, ranging from `0` (transparent) to `255` (opaque), of
--   additional selections.
--   The default value is `256`, for no alpha.
-- @field additional_sel_back (number)
--   The background color, in "0xBBGGRR" format, of additional selections.
--   This field has no effect when calling `buffer:set_sel_back(false, ...)`.
-- @field additional_sel_fore (number)
--   The foreground color, in "0xBBGGRR" format, of additional selections.
--   This field has no effect when calling `buffer:set_sel_fore(false, ...)`.
-- @field additional_selection_typing (bool)
--   Type into multiple selections.
--   The default value is `false`.
-- @field all_lines_visible (bool, Read-only)
--   Whether or not all lines in the buffer are visible.
-- @field anchor (number)
--   The position of the beginning of the selected text.
-- @field annotation_lines (table, Read-only)
--   Table of the number of annotation lines for line numbers starting from
--   zero.
-- @field annotation_style (table)
--   Table of style numbers for annotations for line numbers starting from zero.
--   Only some style attributes are active in annotations: font,
--   size/size_fractional, bold/weight, italics, fore, back, and character_set.
-- @field annotation_style_offset (number)
--   The beginning 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 `annotation_style` has the offset added before
--   looking up the style.
--   The default value is `0`.
-- @field annotation_text (table)
--   Table of annotation text for line numbers starting from zero.
-- @field annotation_visible (number)
--   The annotation visibility mode.
--
--   * `_SCINTILLA.constants.ANNOTATION_HIDDEN` (0)
--     Annotations are invisible.
--   * `_SCINTILLA.constants.ANNOTATION_STANDARD` (1)
--     Draw annotations left-justified with no decoration.
--   * `_SCINTILLA.constants.ANNOTATION_BOXED` (2)
--     Indent annotations to match the text and outline with a box.
--
--   The default value is `0`.
-- @field auto_c_auto_hide (bool)
--   Automatically hide the autocompletion list when no entries match typed
--   text.
--   The default value is `true`.
-- @field auto_c_cancel_at_start (bool)
--   Cancel autocompletion when backspacing to a position before where
--   autocompletion started or before the word being completed.
--   The default value is `true`, to cancel when backspacing before where
--   autocompletion started.
-- @field auto_c_case_insensitive_behaviour (number)
--   The behavior setting for case insensitive autocompletion when
--   [`buffer.auto_c_ignore_case`](#auto_c_ignore_case) is `true`.
--
--   * `_SCINTILLA.constants.SC_CASEINSENSITIVEBEHAVIOR_RESPECTCASE` (0)
--     Prefer to select case-sensitive matches.
--   * `_SCINTILLA.constants.SC_CASEINSENSITIVEBEHAVIOR_IGNORECASE` (1)
--     No preference.
--
--   The default value is `0`.
-- @field auto_c_choose_single (bool)
--   Automatically choose the item in a single-item autocompletion list.
--   The default value is `false`.
-- @field auto_c_current (number, Read-only)
--   The index of the currently selected item in the autocompletion list.
-- @field auto_c_current_text (string, Read-only)
--   The text of the currently selected item in the autocompletion list.
-- @field auto_c_drop_rest_of_word (bool)
--   Delete word characters after autocompleted text.
--   The default value is `false`.
-- @field auto_c_fill_ups (string, Write-only)
--   A set of characters that choose the currently selected item in an
--   autocompletion list when typed.
--   The default value is an empty string.
-- @field auto_c_ignore_case (bool)
--   Ignore case when searching an autocompletion list for matches.
--   The default value is `false`.
-- @field auto_c_max_height (number)
--   The maximum number of items to show in autocompletion and user lists. The
--   default value is `5`.
-- @field auto_c_max_width (number)
--   The maximum number of characters per row to show in autocompletion and user
--   lists.
--   The default value is `0`, which automatically sizes the list to fit the
--   longest item.
-- @field auto_c_separator (number)
--   The character byte that separates autocompletion list items.
--   The default value is `32` (' ').
-- @field auto_c_type_separator (number)
--   The character byte that separates autocompletion list items and their
--   image types.
--   Autocompletion list items can display both an image and text. Register
--   images and their types using [`buffer:register_image()`](#register_image)
--   or [`buffer:register_rgba_image()`](#register_rgba_image) before appending
--   image types to list items after type separator characters.
--   The default value is 63 ('?').
-- @field back_space_un_indents (bool)
--   Un-indent text when backspacing within indentation.
--   The default value is `false`.
-- @field buffered_draw (bool)
--   Buffer drawing to avoid flickering.
--   Buffering draws each line of text into a bitmap buffer before drawing the
--   bitmap to the screen.
--   The default value is `true`.
-- @field call_tip_back (number, Write-only)
--   The background color, in "0xBBGGRR" format, for a call tip.
-- @field call_tip_fore (number, Write-only)
--   The foreground color, in "0xBBGGRR" format, for a call tip.
-- @field call_tip_fore_hlt (number, Write-only)
--   The foreground color, in "0xBBGGRR" format, for the highlighted part of a
--   call tip.
-- @field call_tip_position (boolean)
--   Display the call tip above or below the text.
--   The default value is `false` to display the call tip below the text.
-- @field call_tip_use_style (number)
--   The size in pixels of tab characters in call tips.
--   When non-zero, also enables the use of `_SCINTILLA.constants.STYLE_CALLTIP`
--   instead of `_SCINTILLA.constants.STYLE_DEFAULT` for call tip styles.
--   The default value is `0`, which does not treat tab characters specially.
-- @field caret_fore (number)
--   The foreground color, in "0xBBGGRR" format, of the caret.
-- @field caret_line_back (number)
--   The background color, in "0xBBGGRR" format, of the line containing the
--   caret.
-- @field caret_line_back_alpha (number)
--   The background alpha value, ranging from `0` (transparent) to `255`
--   (opaque), of the caret line.
--   The default value is `256`, for no alpha.
-- @field caret_line_visible (bool)
--   Color the background of the line containing the caret a different color.
--   The default value is `false`.
-- @field caret_line_visible_always (bool)
--   Whether or not the caret line is always visible, even when the window is
--   not in focus.
--   The default value is `false`, showing the caret line only when the window
--   is in focus.
-- @field caret_period (number)
--   The time in milliseconds between caret blinks.
--   A value of `0` stops blinking.
--   The default value is `500`.
-- @field caret_sticky (number)
--   The preferred horizontal position of the caret when moving between lines.
--
--   * `_SCINTILLA.constants.SC_CARETSTICKY_OFF` (0)
--     Use the same position as on the previous line.
--   * `_SCINTILLA.constants.SC_CARETSTICKY_ON` (1)
--     Use the last position the caret was moved to via the mouse, left/right
--     arrow keys, home/end keys, etc. Typing text does not affect the position.
--   * `_SCINTILLA.constants.SC_CARETSTICKY_WHITESPACE` (2)
--     Use the same position as on the previous line, but prior to any inserted
--     indentation.
--
--   The default value is `0`.
-- @field caret_style (number)
--   The style of caret to draw.
--
--   * `_SCINTILLA.constants.CARETSTYLE_INVISIBLE` (0)
--     No caret.
--   * `_SCINTILLA.constants.CARETSTYLE_LINE` (1)
--     A line caret.
--   * `_SCINTILLA.constants.CARETSTYLE_BLOCK` (2)
--     A block caret.
--
--   The default value is `1`.
-- @field caret_width (number)
--   The pixel width of the caret in insert mode, either `0`, `1`, `2`, or `3`,
--   and only applicable to line carets.
--   The default value is `1`.
-- @field char_at (table, Read-only)
--   Table of character bytes at positions in the buffer starting from zero.
-- @field code_page (number)
--   The code page used to interpret buffer bytes as characters.
--
--   + `0` None.
--   + `932` Japanese Shift-JIS.
--   + `936` Simplified Chinese GBK.
--   + `949` Korean Unified Hangul Code.
--   + `950` Traditional Chinese Big5.
--   + `1361` Korean Johab.
--   + `_SCINTILLA.constants.SC_CP_UTF8` (65001) UTF-8.
--
--   The default value is `0`.
-- @field column (table, Read-only)
--   Table of column numbers, taking tab widths into account, for positions in
--   the buffer starting from zero.
-- @field control_char_symbol (number)
--   The byte value of the character displayed in place of control characters,
--   characters whose byte values are less than 32. Values less than 32 dispay
--   ASCII mnemonics instead.
--   The default value is `0`.
-- @field current_pos (number)
--   The position of the caret.
--   When set, does not scroll the caret into view.
-- @field cursor (number)
--   The cursor type.
--
--   * `_SCINTILLA.constants.SC_CURSORNORMAL` (-1)
--     The normal cursor.
--   * `_SCINTILLA.constants.SC_CURSORWAIT` (4)
--     The wait cursor.
--
--   The default value is `-1`.
-- @field dirty (bool)
--   Whether or not the buffer has unsaved changes.
--   Unlike [`buffer.modify`](#modify), this field is accessible from any
--   buffer, not just the global one.
-- @field edge_colour (number)
--   The color, in "0xBBGGRR" format, used for the long line marker.
-- @field edge_column (number)
--   The column number to display the long line marker at.
-- @field edge_mode (number)
--   The long line edge mode.
--
--   * `_SCINTILLA.constants.EDGE_NONE` (0)
--     Long lines are not marked.
--   * `_SCINTILLA.constants.EDGE_LINE` (1)
--     Draw a vertical line whose color is [`buffer.edge_colour`](#edge_colour)
--     at column [`buffer.edge_column`](#edge_column).
--   * `_SCINTILLA.constants.EDGE_BACKGROUND` (2)
--     Change the background color of characters after column
--     [`buffer.edge_column`](#edge_column) to
--     [`buffer.edge_colour`](#edge_colour).
-- @field encoding (string or nil)
--   The string encoding of the file on the hard drive or `nil` for binary
--   files.
-- @field encoding_bom (string)
--   The byte-order mark, if any, of the file encoding.
-- @field end_at_last_line (bool)
--   Disable scrolling past the last line.
--   The default value is `true`.
-- @field end_styled (number, Read-only)
--   The position of the last correctly styled character.
-- @field eol_mode (number)
--   The current end of line mode.
--
--   * `_SCINTILLA.constants.SC_EOL_CRLF` (0)
--     "CR+LF" ("\r\n").
--   * `_SCINTILLA.constants.SC_EOL_CR` (1)
--     "CR" ("\r").
--   * `_SCINTILLA.constants.SC_EOL_LF` (2)
--     "LF" ("\n").
--
--   The default value is `0` on Windows platforms, `2` otherwise.
-- @field extra_ascent (number)
--   The amount of pixel padding above line text.
--   The default value is `0`.
-- @field extra_descent (number)
--   The amount of pixel padding below line text.
--   The default is `0`.
-- @field filename (string)
--   The UTF-8-encoded absolute path to the file associated with the buffer.
--   Use [`string.iconv()`][] and [`_G._CHARSET`][] for charset conversions.
--
--   [`string.iconv()`]: string.html#iconv
--   [`_G._CHARSET`]: _G.html#_CHARSET
-- @field first_visible_line (number)
--   The line number of the line at the top of the view, starting from zero.
-- @field fold_expanded (table)
--   Table of flags indicating whether or not folds are expanded for line
--   numbers starting from zero.
--   Setting expanded fold states does not toggle folds; it only updates fold
--   margin markers. Use [`buffer:toggle_fold()`](#toggle_fold) instead.
-- @field fold_flags (number)
--   Bit-mask of options for drawing folding lines.
--
--   * `_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_EXPANDED` (2)
--     Draw lines above expanded folds.
--   * `_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_CONTRACTED` (4)
--     Draw lines above collapsed folds.
--   * `_SCINTILLA.constants.SC_FOLDFLAG_LINEAFTER_EXPANDED` (8)
--     Draw lines below expanded folds.
--   * `_SCINTILLA.constants.SC_FOLDFLAG_LINEAFTER_CONTRACTED` (16)
--     Draw lines below collapsed folds.
--
--   The default value is `0`.
-- @field fold_level (table)
--   Table of fold level bit-masks for line numbers starting from zero.
--   Fold level masks are composed of an integer level combined with any of the
--   following bits:
--
--   * `_SCINTILLA.constants.SC_FOLDLEVELBASE` (0x400)
--     The initial fold level.
--   * `_SCINTILLA.constants.SC_FOLDLEVELWHITEFLAG` (0x1000)
--     The line is blank.
--   * `_SCINTILLA.constants.SC_FOLDLEVELHEADERFLAG` (0x2000)
--     The line is a header, or fold point.
-- @field fold_parent (table, Read-only)
--   Table of parent line numbers (fold points) for child line numbers starting
--   from zero.
--   A line number of `-1` means no line was found.
-- @field h_scroll_bar (bool)
--   Display the horizontal scroll bar.
--   The default value is `true`.
-- @field highlight_guide (number)
--   The indentation guide column number to highlight, or `0` to stop
--   highlighting.
-- @field hotspot_active_underline (bool)
--   Underline active hotspots.
--   The default value is `true`.
-- @field hotspot_single_line (bool)
--   Limit hotspots to a single line.
--   The default value is `true`.
-- @field indent (number)
--   The number of spaces used for one level of indentation.
--   The default value is `0`, which matches the tab size.
-- @field indentation_guides (number)
--   The indentation guide drawing mode.
--   Indentation guides are dotted vertical lines that appear within indentation
--   whitespace at each level of indentation.
--
--   * `_SCINTILLA.constants.SC_IV_NONE` (0)
--     Guides are not drawn.
--   * `_SCINTILLA.constants.SC_IV_REAL` (1)
--     Draw guides only within indentation whitespace.
--   * `_SCINTILLA.constants.SC_IV_LOOKFORWARD` (2)
--     Draw guides beyond the current line up to the level of the next non-empty
--     line, but with an additional level if the previous non-empty line is a
--     fold header.
--   * `_SCINTILLA.constants.SC_IV_LOOKBOTH` (3)
--     Draw guides beyond the current line up to either the level of the
--     previous or next non-empty line, whichever is greater.
--
--   The default value is `0`.
-- @field indic_alpha (table)
--   Table of fill color alpha values, ranging from `0` (transparent) to `255`
--   (opaque), for indicator numbers from `0` to `31` whose styles are either
--   `INDIC_ROUNDBOX`, `INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
--   The default values are `256`, for no alpha.
-- @field indic_fore (table)
--   Table of foreground colors, in "0xBBGGRR" format, for indicator numbers
--   from `0` to `31`.
-- @field indic_outline_alpha (table)
--   Table of outline color alpha values, ranging from `0` (transparent) to
--   `255` (opaque), for indicator numbers from `0` to `31` whose styles are
--   either `INDIC_ROUNDBOX`, `INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
--   The default values are `256`, for no alpha.
-- @field indic_style (table)
--   Table of styles for indicator numbers from `0` to `31`.
--
--   * `_SCINTILLA.constants.INDIC_PLAIN` (0)
--     An underline.
--   * `_SCINTILLA.constants.INDIC_SQUIGGLE` (1)
--     A squiggly underline 3 pixels in height.
--   * `_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)
--     Invisible.
--   * `_SCINTILLA.constants.INDIC_BOX` (6)
--     A rectangle around the text.
--   * `_SCINTILLA.constants.INDIC_ROUNDBOX` (7)
--     A translucent rectangle with rounded corners around the text. Use
--     [`buffer.indic_alpha`](#indic_alpha) and
--     [`buffer.indic_outline_alpha`](#indic_outline_alpha) to set the fill and
--     outline transparency, respectively. Their default values are `30` and
--     `50`.
--   * `_SCINTILLA.constants.INDIC_STRAIGHTBOX` (8)
--     Similar to `INDIC_ROUNDBOX` but with sharp corners.
--   * `_SCINTILLA.constants.INDIC_DASH` (9)
--     A dashed underline.
--   * `_SCINTILLA.constants.INDIC_DOTS` (10)
--     A dotted underline.
--   * `_SCINTILLA.constants.INDIC_SQUIGGLELOW` (11)
--     A squiggly underline 2 pixels in height.
--   * `_SCINTILLA.constants.INDIC_DOTBOX` (12)
--     Similar to `INDIC_STRAIGHTBOX` but with a dotted outline.
--     Translucency alternates between [`buffer.indic_alpha`](#indic_alpha) and
--     [`buffer.indic_outline_alpha`](#indic_outline_alpha) starting with the
--     top-left pixel.
--   * `_SCINTILLA.constants.INDIC_SQUIGGLEPIXMAP` (13)
--     Identical to `INDIC_SQUIGGLE` but draws faster by using a pixmap instead
--     of multiple line segments.
--
--   Use [`_SCINTILLA.next_indic_number()`][] for custom indicators.
--
--   [`_SCINTILLA.next_indic_number()`]: _SCINTILLA.html#next_indic_number
-- @field indic_under (table)
--   Table of flags indicating whether or not to draw indicators over text or
--   under it for indicator numbers from `0` to `31`.
--   For values to be `true`, [`buffer.two_phase_draw`](#two_phase_draw) must be
--   `true`.
--   The default values are `false` for drawing indicators over text.
-- @field indicator_current (number)
--   The indicator number in the range of `0` to `31` used by
--   [`buffer:indicator_fill_range()`](#indicator_fill_range) and
--   [`buffer:indicator_clear_range()`](#indicator_clear_range).
-- @field indicator_value (number)
--   The indicator value used for
--   [`buffer:indicator_fill_range()`](#indicator_fill_range).
--   Currently, all values are drawn the same, but it may be possible to draw
--   different values in different styles in the future.
-- @field layout_cache (number)
--   The layout cache mode.
--
--   * `_SCINTILLA.constants.SC_CACHE_NONE` (0)
--     No lines are cached.
--   * `_SCINTILLA.constants.SC_CACHE_CARET` (1)
--     Cache the line containing the caret.
--   * `_SCINTILLA.constants.SC_CACHE_PAGE` (2)
--     Cache visible lines.
--   * `_SCINTILLA.constants.SC_CACHE_DOCUMENT` (3)
--     Cache all lines in the buffer.
--
--   The default value is `1`.
-- @field length (number, Read-only)
--   The number of bytes in the buffer.
-- @field lexer (number)
--   The numeric ID of the Scintilla lexer used by the buffer.
-- @field lexer_language (string)
--   The name of the Scintilla lexer used by the buffer.
--   You probably want to use [`buffer:get_lexer()`](#get_lexer) instead.
-- @field line_count (number, Read-only)
--   The number of lines in the buffer.
--   There is always at least one.
-- @field line_end_position (table, Read-only)
--   Table of positions at the ends of lines, but before any end of line
--   characters, for line numbers starting from zero.
-- @field line_indent_position (table, Read-only)
--   Table of positions at the ends of line indentation for line numbers
--   starting from zero.
-- @field line_indentation (table)
--   Table of line indentation amounts, measured in character columns, for line
--   numbers starting from zero.
-- @field line_state (table)
--   Table of integer line states for line numbers starting from zero.
--   Line states are used for storing longer lived parse states per line. They
--   are available in addition to the 8 bits of styling information per
--   character.
-- @field line_visible (table, Read-only)
--   Table of flags indicating whether or not lines are visible for line numbers
--   starting from zero.
-- @field lines_on_screen (number, Read-only)
--   The number of completely visible lines in the view.
--   It is possible to have a partial line visible at the bottom of the view.
-- @field main_selection (number)
--   The main, or most recent, selection.
--   Only an existing selection can be made main.
-- @field margin_cursor_n (table)
--   Table of cursors shown for margin numbers from zero to four.
--
--   * `_SCINTILLA.constants.SC_CURSORARROW` (2)
--     Normal arrow cursor.
--   * `_SCINTILLA.constants.SC_CURSORREVERSEARROW` (7)
--     Reversed arrow cursor.
--
--   The default values are `7`.
-- @field margin_left (number)
--   The size in pixels of the left margin of the buffer text.
--   The default value is `1`.
-- @field margin_mask_n (table)
--   Table of marker bit-masks for showing margin markers for margin numbers
--   from zero to four.
--   The default values are `0`, `0x1FFFFFF`, `0`, `0`, and `0`, for a line
--   margin and logical marker margin.
-- @field margin_options (number)
--   A bit-mask of margin option settings.
--
--   * `_SCINTILLA.constants.SC_MARGINOPTION_NONE` (0)
--     None.
--   * `_SCINTILLA.constants.SC_MARGINOPTION_SUBLINESELECT` (1)
--     Select only the sub-line of the wrapped line on margin click.
--
--   The default value is `0`.
-- @field margin_right (number)
--   The size in pixels of the right margin of the buffer text.
--   The default value is `1`.
-- @field margin_sensitive_n (table)
--   Table of flags indicating whether or not mouse clicks in margins emit
--   `MARGIN_CLICK` events for margin numbers from zero to four.
--   The default values are `false`.
-- @field margin_style (table)
--   Table of style numbers for text margin line numbers starting from zero.
--   Only some style attributes are active in text margins: font,
--   size/size_fractional, bold/weight, italics, fore, back, and character_set.
-- @field margin_style_offset (number)
--   The beginning 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 `margin_style` has
--   the offset added before looking up the style.
-- @field margin_text (table)
--   Table of text in the text margin for line numbers starting from zero.
-- @field margin_type_n (table)
--   Table of margin types for margin numbers 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 whose background color matches the default text
--     background color.
--   * `_SCINTILLA.constants.SC_MARGIN_FORE` (3)
--     A symbol margin whose foreground color matches 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.
--
--   The default values are `true`, `false`, `false`, `false`, and `false`, for
--   a line number margin and symbol margins.
-- @field margin_width_n (table)
--   Table of margin widths in pixels for margin numbers from zero to four.
-- @field marker_alpha (table, Write-only)
--   Table of alpha values, ranging from `0` (transparent) to `255` (opaque),
--   used for markers drawn in the text area, not the margin, for markers
--   numbers from `0` to `31`.
--   The default values are `256`, for no alpha.
-- @field marker_back (table, Write-only)
--   Table of background colors, in "0xBBGGRR" format, used for marker numbers
--   from `0` to `31`.
-- @field marker_back_selected (table, Write-only)
--   Table of background colors, in "0xBBGGRR" format, used for markers whose
--   folding blocks are selected for marker numbers from `0` to `31`.
--   The default values are `0x0000FF`.
-- @field marker_fore (table, Write-only)
--   Table of foreground colors, in "0xBBGGRR" format, used for marker numbers
--   from `0` to `31`.
-- @field max_line_state (number, Read-only)
--   The last line number with a non-zero line state.
-- @field modify (bool)
--   Whether or not the buffer has unsaved changes.
--   Unlike [`buffer.dirty`](#dirty), this field is accessible only from the
--   global buffer.
-- @field mouse_dwell_time (number)
--   The number of milliseconds the mouse must idle in order to generate a
--   `DWELL_START` event, or `_SCINTILLA.constants.SC_TIME_FOREVER` to never
--   generate one.
-- @field multi_paste (number)
--   The multiple selection paste mode.
--
--   * `_SCINTILLA.constants.SC_MULTIPASTE_ONCE` (0)
--     Paste into only the main selection.
--   * `_SCINTILLA.constants.SC_MULTIPASTE_EACH` (1)
--     Paste into all selections.
--
--   The default value is `0`.
-- @field multiple_selection (bool)
--   Enable multiple selection.
--   The default value is `false`.
-- @field overtype (bool)
--   Enable overtype mode, where typed characters overwrite existing ones.
--   The default value is `false`.
-- @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.
--   The default value is `1024`.
-- @field print_colour_mode (number)
--   The print color mode.
--
--   * `_SCINTILLA.constants.SC_PRINT_NORMAL` (0)
--     Print with the current set of colors.
--   * `_SCINTILLA.constants.SC_PRINT_INVERTLIGHT` (1)
--     Print on a white background with the light values of the current color
--     set.
--     This mode is good for a dark background color.
--   * `_SCINTILLA.constants.SC_PRINT_BLACKONWHITE` (2)
--     Print black text on a white background.
--   * `_SCINTILLA.constants.SC_PRINT_COLOURONWHITE` (3)
--     Print on a white background with the current color set.
--   * `_SCINTILLA.constants.SC_PRINT_COLOURONWHITEDEFAULTBG` (4)
--     Print on a white background with the current color set except for line
--     numbers which use their own background color.
-- @field print_magnification (number)
--   The number of points to add to the size of each font when printing.
--   Negative values are allowed.
--   The default value is `0`.
-- @field print_wrap_mode (number)
--   The print line wrap mode.
--
--   * `_SCINTILLA.constants.SC_WRAP_NONE` (0)
--     Truncate long lines.
--   * `_SCINTILLA.constants.SC_WRAP_WORD` (1)
--     Wrap long lines at word boundaries if possible.
--   * `_SCINTILLA.constants.SC_WRAP_CHAR` (2)
--     Wrap long lines at character boundaries.
-- @field property (table)
--   Map of key-value string pairs used by lexers.
-- @field property_expanded (table, Read-only)
--   Map of key-value string pairs used by lexers with `$()` variable
--   replacement performed in values.
-- @field property_int (table, Read-only)
--   Map of key-value pairs used by lexers with values interpreted as numbers,
--   or `0` if not found.
-- @field punctuation_chars (string)
--   The set of characters considered to be punctuation characters.
--   Set this only after setting [`buffer.word_chars`](#word_chars).
--   The default value is a string containing all characters not considered to
--   be whitespace or word characters.
-- @field read_only (bool)
--   Whether or not the buffer is read-only.
--   The default value is `false`.
-- @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 in combination with a mouse drag to create a
--   rectangular selection.
--
--   * `_SCINTILLA.constants.SCMOD_CTRL` (2)
--     The "Control" modifier key.
--   * `_SCINTILLA.constants.SCMOD_ALT` (4)
--     The "Alt" modifier key.
--   * `_SCINTILLA.constants.SCMOD_SUPER` (8)
--     The "Super" modifier key, usually defined as the left "Windows" or
--     "Command" key.
--
--   The default value is `2`.
-- @field rgba_image_height (number)
--   The height for an RGBA image to be defined using
--   [`buffer:marker_define_rgba_image()`](#marker_define_rgba_image).
-- @field rgba_image_scale (number)
--   The scale factor in percent for an RGBA image to be defined using
--   [`buffer:marker_define_rgba_image()`](#marker_define_rgba_image).
--   This is useful on OSX with a retina display where each display unit is 2
--   pixels: use a factor of `200` so that each image pixel is dsplayed using a
--   screen pixel. The default scale, `100`, will stretch each image pixel to
--   cover 4 screen pixels on a retina display.
-- @field rgba_image_width (number)
--   The width for an RGBA image to be defined using
--   [`buffer:marker_define_rgba_image()`](#marker_define_rgba_image).
-- @field scroll_width (number)
--   The assumed buffer width for horizontal scrolling purposes.
--   For performance, the view does not measure the display width of the buffer
--   to determine the properties of the horizontal scroll bar, but uses an
--   assumed width instead. To ensure the width of the currently visible lines
--   can be scrolled use
--   [`buffer.scroll_width_tracking`](#scroll_width_tracking).
--   The default value is `2000`.
-- @field scroll_width_tracking (bool)
--   Set the scroll width to the maximum width of a displayed line beyond
--   [`buffer.scroll_width`](#scroll_width).
--   The default value is `false`.
-- @field search_flags (number)
--   The bit-mask of search flags used by
--   [`buffer:search_in_target()`](#search_in_target).
--
--   * `_SCINTILLA.constants.SCFIND_WHOLEWORD` (2)
--     Match text surrounded by non-word characters.
--   * `_SCINTILLA.constants.SCFIND_MATCHCASE` (4)
--     Match text case sensitively.
--   * `_SCINTILLA.constants.SCFIND_WORDSTART` (0x00100000)
--     Match text when the previous character is a non-word character.
--   * `_SCINTILLA.constants.SCFIND_REGEXP` (0x00200000)
--     Interpret the search string as a regular expression.
--   * `_SCINTILLA.constants.SCFIND_POSIX` (0x00400000)
--     Interpret '(' and ')' as tags instead of "\\(" and "\\)" in a regular
--     expression.
--
--   The default value is `0`.
-- @field sel_alpha (number)
--   The alpha value, ranging from `0` (transparent) to `255` (opaque), of the
--   selection.
--   The default value is `256`, for no alpha.
-- @field sel_eol_filled (bool)
--   Extend the selection to the right margin of the view.
--   The default value is `false`.
-- @field selection_empty (bool, Read-only)
--   Whether or not no text is selected.
-- @field selection_end (number)
--   The position of the end of the selected text.
--   When set, becomes the current position, but is not scrolled into view.
-- @field selection_is_rectangle (bool, Read-only)
--   Whether or not the selection is a rectangular selection.
-- @field selection_mode (number)
--   The selection mode.
--
--   * `_SCINTILLA.constants.SC_SEL_STREAM` (0)
--     Character selection.
--   * `_SCINTILLA.constants.SC_SEL_RECTANGLE` (1)
--     Rectangular selection.
--   * `_SCINTILLA.constants.SC_SEL_LINES` (2)
--     Line selection.
--   * `_SCINTILLA.constants.SC_SEL_THIN` (3)
--     Thin rectangular selection. This is the mode after a rectangular
--     selection has been typed into and ensures that no characters are
--     selected.
--
--   When set, caret movement alters the selected text until this field is set
--   again to the same value or [`buffer:cancel()`](#cancel) is called.
-- @field selection_n_anchor (table)
--   Table of anchor positions for existing selections numbered from zero, the
--   main selection.
-- @field selection_n_anchor_virtual_space (table)
--   Table of the amount of virtual space for anchors for existing selections
--   numbered from zero, the main selection.
-- @field selection_n_caret (table)
--   Table of caret positions for existing selections numbered from zero, the
--   main selection.
-- @field selection_n_caret_virtual_space (table)
--   Table of the amount of virtual space for carets for existing selections
--   numbered from zero, the main selection.
-- @field selection_n_end (table)
--   Table of positions at the end of existing selections numbered from zero,
--   the main selection.
-- @field selection_n_start (table)
--   Table of positions at the beginning of existing selections numbered from
--   zero, the main selection.
-- @field selection_start (number)
--   The position of the beginning of the selected text.
--   When set, becomes the anchor, but is not scrolled into view.
-- @field selections (number, Read-only)
--   The number of active selections.
-- @field style_at (table, Read-only)
--   Table of style bytes at positions in the buffer starting from zero.
-- @field style_back (table)
--   Table of background colors, in "0xBBGGRR" format, for style numbers from
--   `0` to `255`.
-- @field style_bits (number)
--   The number of bits in an 8-bit style byte to use for styling.
--   The number of styling bits required by the current lexer is
--   [`buffer.style_bits_needed`](#style_bits_needed).
--   The default value is `5`.
-- @field style_bits_needed (number, Read-only)
--   The number of styling bits required by the current lexer.
-- @field style_bold (table)
--   Table of flags indicating whether or not text within styles has a bold font
--   face for style numbers from `0` to `255`.
--   The default values are `false`.
-- @field style_case (table)
--   Table of letter case modes for text within styles for style numbers from
--   `0` to `255`.
--
--   * `_SCINTILLA.constants.SC_CASE_MIXED` (0)
--     Display text in mixed case.
--   * `_SCINTILLA.constants.SC_CASE_UPPER` (1)
--     Display text in upper case.
--   * `_SCINTILLA.constants.SC_CASE_LOWER` (2)
--     Display text in lower case.
--
--   The default values are `0`.
-- @field style_changeable (table)
--   Table of flags indicating whether or not text within styles is changeable
--   for style numbers from `0` to `255`.
--   The default values are `true`.
--   Currently, read-only styles do not allow the caret into the range of text,
--   but ranges containing read-only text are deletable.
-- @field style_character_set (table)
--   Table of character sets for style numbers from `0` to `255`.
--
--   * `_SCINTILLA.constants.SC_CHARSET_ANSI` (0)
--   * `_SCINTILLA.constants.SC_CHARSET_DEFAULT` (1)
--   * `_SCINTILLA.constants.SC_CHARSET_CYRILLIC` (1251)
--   * `_SCINTILLA.constants.SC_CHARSET_EASTEUROPE` (238)
--   * `_SCINTILLA.constants.SC_CHARSET_GB2312` (134)
--   * `_SCINTILLA.constants.SC_CHARSET_HANGUL` (129)
--   * `_SCINTILLA.constants.SC_CHARSET_RUSSIAN` (204)
--   * `_SCINTILLA.constants.SC_CHARSET_SHIFTJIS` (128)
--   * `_SCINTILLA.constants.SC_CHARSET_8859_15` (1000)
--
--   The default values are `1`.
-- @field style_eol_filled (table)
--   Table of flags indicating whether or not to extend the background colors of
--   styles whose characters occur last on lines all the way to the right margin
--   of the view for style numbers from `0` to `255`.
--   The default values are `false`.
-- @field style_font (table)
--   Table of font faces for style numbers from `0` to `255`.
-- @field style_fore (table)
--   Table of foreground colors, in "0xBBGGRR" format, for style numbers from
--   `0` to `255`.
-- @field style_hot_spot (table)
--   Table of flags indicating whether or not text within styles is clickable
--   for style numbers from `0` to `255`.
--   The default values are `false`.
-- @field style_italic (table)
--   Table of flags indicating whether or not text within styles has an italic
--   font face for style numbers from `0` to `255`.
--   The default values are `false`.
-- @field style_size (table)
--   Table of font sizes, expressed in whole number points, for style numbers
--   from `0` to `255`.
-- @field style_size_fractional (table)
--   Table of character sizes, expressed in hundredths of a point, for style
--   numbers from `0` to `255`.
--   For example, a text size of 9.4 points is set using `940`.
-- @field style_underline (table)
--   Table of flags indicating whether or not text within styles has an
--   underlined font face for style numbers from `0` to `255`.
--   The default values are `false`.
-- @field style_visible (table)
--   Table of flags indicating whether or not text within styles is visible for
--   style numbers from `0` to `255`.
--   The default values are `true`.
-- @field style_weight (table)
--   Table of character weights ranging from `1` (very light) to `999` (very
--   heavy) for text within styles for style numbers from `0` to `255`.
--   However, most fonts only support a small number of weights:
--
--   * `_SCINTILLA.constants.SC_WEIGHT_NORMAL` (400)
--     Normal.
--   * `_SCINTILLA.constants.SC_WEIGHT_SEMIBOLD` (600)
--     Semi-bold.
--   * `_SCINTILLA.constants.SC_WEIGHT_BOLD` (700)
--     Bold.
--
--   The default values are `400`.
-- @field tab_indents (bool)
--   Tabbing indents within indentation.
--   The default value is `false`.
-- @field tab_width (number)
--   The number of space characters represented by a tab character.
--   The default value is `8`.
-- @field tag (table)
--   List of tag match values from a regular expression search.
-- @field target_end (number)
--   The position of the end of the target range.
--   This is also set by a successful
--   [`buffer:search_in_target()`](#search_in_target).
-- @field target_start (number)
--   The position of the beginning of the target range.
--   This is also set by a successful
--   [`buffer:search_in_target()`](#search_in_target).
-- @field text_length (number, Read-only)
--   The number of characters in the buffer.
-- @field two_phase_draw (bool)
--   Draw in two phases: first the background and then the foreground.
--   The default is `true`.
-- @field undo_collection (bool)
--   Collect undo information.
--   When setting to `false`, call
--   [`buffer:empty_undo_buffer()`](#empty_undo_buffer) to avoid desynchronizing
--   the undo buffer with the buffer text.
--   The default value is `true`.
-- @field use_tabs (bool)
--   Use tabs or spaces in indentation.
--   The default value is `true`, for using tabs.
-- @field v_scroll_bar (bool)
--   Display the vertical scroll bar.
--   The default value is `true`.
-- @field view_eol (bool)
--   Display end of line characters.
--   The default value is `false`.
-- @field view_ws (number)
--   The whitespace character visibility mode.
--
--   * `_SCINTILLA.constants.SCWS_INVISIBLE` (0)
--     Whitespace is invisible.
--   * `_SCINTILLA.constants.SCWS_VISIBLEALWAYS` (1)
--     Display whitespace as dots and arrows.
--   * `_SCINTILLA.constants.SCWS_VISIBLEAFTERINDENT` (2)
--     Display non-indentation whitespace as dots and arrows.
--
--   The default value is `0`.
-- @field virtual_space_options (number)
--   The virtual space mode.
--
--   * `_SCINTILLA.constants.SCVS_NONE` (0)
--     Disable virtual space.
--   * `_SCINTILLA.constants.SCVS_RECTANGULARSELECTION` (1)
--     Enable virtual space only for rectangular selections.
--   * `_SCINTILLA.constants.SCVS_USERACCESSIBLE` (2)
--     Enable virtual space.
--
--   The default value is `0`.
-- @field whitespace_chars (string)
--   The set of characters considered to be whitespace characters when moving
--   or selecting text by word.
--   Set this only after setting [`buffer.word_chars`](#word_chars).
--   The default value is a string containing all non-newline characters less
--   than ASCII value 33.
-- @field whitespace_size (number)
--   The size of the dots in pixels used to represent space characters when
--   whitespace is visible.
--   The default value is `1`.
-- @field word_chars (string)
--   The set of characters considered to be word characters when moving or
--   selecting text by word.
--   The default value is a string containing alphanumeric characters, an
--   underscore, and all characters greater than ASCII value 127.
-- @field wrap_indent_mode (number)
--   The wrapped line indent mode.
--
--   * `_SCINTILLA.constants.SC_WRAP_INDENT_FIXED` (0)
--     Indent wrapped lines by [`buffer.wrap_start_indent`](#wrap_start_indent).
--   * `_SCINTILLA.constants.SC_WRAP_INDENT_SAME` (1)
--     Indent wrapped lines the same as the first line.
--   * `_SCINTILLA.constants.SC_WRAP_INDENT_INDENT` (2)
--     Indent wrapped lines one more level than the first line.
-- @field wrap_mode (number)
--   Long line wrap mode.
--
--   * `_SCINTILLA.constants.SC_WRAP_NONE` (0)
--     Long lines are not wrapped.
--   * `_SCINTILLA.constants.SC_WRAP_WORD` (1)
--     Wrap long lines at word boundaries.
--   * `_SCINTILLA.constants.SC_WRAP_CHAR` (2)
--     Wrap long lines at character boundaries.
--
--   The default value is `0`.
-- @field wrap_start_indent (number)
--   The number of spaces to indent wrapped lines by if
--   [`buffer.wrap_indent_mode`](#wrap_indent_mode) is
--   `_SCINTILLA.constants.SC_WRAP_INDENT_FIXED`.
--   The default value is `0`.
-- @field wrap_visual_flags (number)
--   The wrapped line visual display mode.
--
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAG_NONE` (0)
--     No visual flags.
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAG_END` (1)
--     Show visual flag at the end of the line.
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAG_START` (2)
--     Show visual flag at the beginning of the sub-line.
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAG_MARGIN` (4)
--     Show visual flag in the line number margin of the sub-line.
--
--   The default value is `0`.
-- @field wrap_visual_flags_location (number)
--   The wrapped line visual flag drawing mode.
--
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAGLOC_DEFAULT` (0)
--     Draw the visual flag near the right border.
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAGLOC_END_BY_TEXT` (1)
--     Draw the visual flag near text at the end of the line.
--   * `_SCINTILLA.constants.SC_WRAPVISUALFLAGLOC_START_BY_TEXT` (2)
--     Draw the visual flag near text at the beginning of the subline.
--
--   The default value is `0`.
-- @field x_offset (number)
--   The horizontal scroll position in pixels.
--   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 to add to the size of all fonts.
--   Negative values are allowed.
--   The default value is `0`.
module('buffer')

---
-- Selects the change of text from *anchor* to *caret* as the main selection,
-- retaining all other selections as additional selections.
-- Even if no text is selected, the current position counts as an empty
-- selection. Use `buffer:set_selection()` first when setting a list of
-- selections.
-- @param buffer The global buffer.
-- @param caret The caret position of the range of text to select in *buffer*.
-- @param anchor The anchor position of the range of text to select in *buffer*.
function add_selection(buffer, caret, anchor) end

---
-- Adds string *text* to the buffer at the caret and moves the caret to the end
-- of the added text, but does not scroll it into view.
-- @param buffer The global buffer.
-- @param text The text to add.
function add_text(buffer, text) end

---
-- Enlarges the buffer to store *bytes* number of bytes, but never shrinks it
-- beyond the size of its contents.
-- @param buffer The global buffer.
-- @param bytes The number of bytes *buffer* can store.
function allocate(buffer, bytes) end

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

---
-- Appends string *text* to the end of the buffer without changing the selected
-- text or scrolling the text into view.
-- @param buffer The global buffer.
-- @param text The text to append.
function append_text(buffer, text) end

---
-- Returns whether or not an autocompletion list is visible.
-- @param buffer The global buffer.
-- @return bool
function auto_c_active(buffer) end

---
-- Cancels the autocompletion list.
-- @param buffer The global buffer.
function auto_c_cancel(buffer) end

---
-- Autocompletes the selected word in the list.
-- @param buffer The global buffer.
function auto_c_complete(buffer) end

---
-- Returns the position where autocompletion started at.
-- @param buffer The global buffer.
-- @return number
function auto_c_pos_start(buffer) end

---
-- Selects the first item in the autocompletion list that starts with *string*,
-- considering case sensitiveness depending on `buffer.auto_c_ignore_case`.
-- @param buffer The global buffer.
-- @param string The item in the list to select.
function auto_c_select(buffer, string) end

---
-- Displays an autocompletion list from *item_list*, a sorted string whose items
-- are delimited by `buffer.auto_c_separator` characters, using *len_entered*
-- number of characters behind the caret as the prefix of the word to
-- autocomplete.
-- @param buffer The global buffer.
-- @param len_entered The number of characters before the caret used to provide
--   the context.
-- @param item_list The sorted string of words to show, separated by
--   `buffer.auto_c_separator` characters (initially spaces).
function auto_c_show(buffer, len_entered, item_list) end

---
-- Defines *chars* as the set of characters that cancel autocompletion when
-- typed.
-- The default set is an empty string.
-- @param buffer The global buffer.
-- @param chars The string of characters that cancel autocompletion. This string
--   is empty by default.
function auto_c_stops(buffer, chars) end

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

---
-- Starts a sequence of actions to undo or redo as a single action.
-- May be nested.
-- @param buffer The global buffer.
function begin_undo_action(buffer) end

---
-- Highlights the character at position *pos* as an unmatched brace character in
-- the `_SCINTILLA.constants.STYLE_BRACEBAD` style.
-- Removes highlighting when *pos* is `-1`.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to highlight, or `-1` to remove the
--   highlight.
function brace_bad_light(buffer, pos) end

---
-- Highlights unmatched brace characters with indicator number *indic_num*, in
-- the range of `0` to `31`, instead of the
-- `_SCINTILLA.constants.STYLE_BRACEBAD` style if *use_indicator* is `true`.
-- @param buffer The global buffer.
-- @param use_indicator Whether or not to use an indicator.
-- @param indic_num The indicator number to use.
function brace_bad_light_indicator(buffer, use_indicator, indic_num) end

---
-- Highlights the characters at positions *pos1* and *pos2* as matching braces
-- in the `_SCINTILLA.constants.STYLE_BRACELIGHT` style.
-- If indent guides are enabled, locate the column with `buffer.column` and
-- set `buffer.highlight_guide` in order to highlight the indent guide.
-- @param buffer The global buffer.
-- @param pos1 The first position in *buffer* to highlight.
-- @param pos2 The second position in *buffer* to highlight.
function brace_highlight(buffer, pos1, pos2) end

---
-- Highlights matching brace characters with indicator number *indic_num*, in
-- the range of `0` to `31`, instead of the
-- `_SCINTILLA.constants.STYLE_BRACELIGHT` style if *use_indicator* is `true`.
-- @param buffer The global buffer.
-- @param use_indicator Whether or not to use an indicator.
-- @param indic_num The indicator number to use.
function brace_highlight_indicator(buffer, use_indicator, indic_num) end

---
-- Returns the position of the matching brace for the brace character at
-- position *pos*, taking nested braces into account, or `-1`.
-- The brace characters recognized are '(', ')', '[', ']', '{', '}', '<', and
-- '>' and must have the same style.
-- @param buffer The global buffer.
-- @param pos The position of the brace in *buffer* to match.
-- @return number.
function brace_match(buffer, pos) end

---
-- Returns whether or not a call tip is visible.
-- @param buffer The global buffer.
-- @return bool
function call_tip_active(buffer) end

---
-- Removes the call tip from view.
-- @param buffer The global buffer.
function call_tip_cancel(buffer) end

---
-- Returns the position where the call tip displayed at.
-- @param buffer The global buffer.
-- @return number
function call_tip_pos_start(buffer) end

---
-- Highlights call tip text from *start_pos*, starting from zero, to *end_pos*
-- with the color `buffer.call_tip_fore_hlt`.
-- @param buffer The global buffer.
-- @param start_pos The start position in the call tip text to highlight.
-- @param end_pos The end position in the call tip text to highlight.
function call_tip_set_hlt(buffer, start_pos, end_pos) end

---
-- Displays a call tip containing string *text* for the word behind position
-- *pos*.
-- Any "\001" or "\002" bytes in *text* are replaced by arrow visuals,
-- indicating the word has more than one call tip.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to show the call tip at.
-- @param text The call tip text to show.
function call_tip_show(buffer, pos, text) end

---
-- Returns whether or not the clipboard has text to paste.
-- @param buffer The global buffer.
-- @return bool
function can_paste(buffer) end

---
-- Returns whether or not there is an action to redo.
-- @param buffer The global buffer.
-- @return bool
function can_redo(buffer) end

---
-- Returns whether or not there is an action to undo.
-- @param buffer The global buffer.
-- @return bool
function can_undo(buffer) end

---
-- Cancels the active call tip, autocompletion list, user list, selection mode,
-- etc.
-- @param buffer The global buffer.
function cancel(buffer) end

---
-- Tells the lexer to re-process the range of text from *start_pos* to
-- *end_pos*.
-- @param buffer The global buffer.
-- @param start_pos The start position of the range of text in *buffer* to
--   re-process.
-- @param end_pos The end position of the range of text in *buffer* to
--   re-process.
function change_lexer_state(buffer, start_pos, end_pos) end

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

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

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

---
-- Returns the character position closest to view coordinates *x* and *y*.
-- @param buffer The global buffer.
-- @param x The x-coordinate in the view to use.
-- @param y The y-coordinate in the view to use.
-- @return number
function char_position_from_point(buffer, x, y) end

---
-- Returns the character position closest to view coordinates *x* and *y*, or
-- `-1` if the point is outside the window or not close to any text.
-- @param buffer The global buffer.
-- @param x The x-coordinate in the view to use.
-- @param y The y-coordinate in the view to use.
-- @return number
function char_position_from_point_close(buffer, x, y) end

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

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

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

---
-- Sets the preferred horizontal position of the caret when moving between
-- lines to the current position.
-- @param buffer The global buffer.
-- @see caret_sticky
function choose_caret_x(buffer) end

---
-- Deletes the selected text or the character at the caret.
-- @param buffer The global buffer.
function clear(buffer) end

---
-- Deletes all of the text in the buffer unless the buffer is read-only.
-- @param buffer The global buffer.
function clear_all(buffer) end

---
-- Clears Scintilla's internal key bindings.
-- @param buffer The global buffer.
function clear_all_cmd_keys(buffer) end

---
-- Clears all styling and folding information in the buffer.
-- @param buffer The global buffer.
function clear_document_style(buffer) end

---
-- Clears all images registered using `buffer:register_image()` and
-- `buffer:register_rgba_image()`.
-- @param buffer The global buffer.
function clear_registered_images(buffer) end

---
-- Removes all selections and moves the caret to the beginning of the buffer.
-- @param buffer The global buffer.
function clear_selections(buffer) end

---
-- Tells the lexer to style and fold the range of text from *start_pos* to
-- *end_pos*.
-- If *end_pos* is `-1`, styles and folds to the end of the buffer.
-- @param buffer The global buffer.
-- @param start_pos The start position of the range of text in *buffer* to
--   process.
-- @param end_pos The end position of the range of text in *buffer* to process,
--   or `-1` to process from *start_pos* to the end of *buffer*.
function colourise(buffer, start_pos, end_pos) end

---
-- Returns the line number of the next contracted fold header line starting at
-- *line_start*, or `-1`.
-- @param buffer The global buffer.
-- @param line_start The line number in *buffer* to start at.
-- @return number
function contracted_fold_next(buffer, line_start) end

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

---
-- Copies the selected text to the clipboard.
-- Multiple selections are copied in order with no delimiters. Rectangular
-- selections are copied from top to bottom with line ending delimiters. Virtual
-- space is not copied.
-- @param buffer The global buffer.
function copy(buffer) end

---
-- Copies the selected text or the current line to the clipboard.
-- @param buffer The global buffer.
function copy_allow_line(buffer) end

---
-- Copies the range of text from *start_pos* to *end_pos* to the clipboard.
-- @param buffer The global buffer.
-- @param start_pos The start position of the range of text in *buffer* to copy.
-- @param end_pos The end position of the range of text in *buffer* to copy.
function copy_range(buffer, start_pos, end_pos) end

---
-- Copies string *text* to the clipboard.
-- @param buffer The global buffer.
-- @param text The text to copy.
function copy_text(buffer, text) end

---
-- Returns the number of whole characters in-between positions *start_pos* and
-- *end_pos*.
-- @param buffer The global buffer.
-- @param start_pos The start position of the range of text in *buffer* to start
--   counting at.
-- @param end_pos The end position of the range of text in *buffer* to stop
--   counting at.
-- @return number
function count_characters(buffer, start_pos, end_pos) end

---
-- Cuts the selected text to the clipboard.
-- Multiple selections are copied in order with no delimiters. Rectangular
-- selections are copied from top to bottom with line ending delimiters. Virtual
-- space is not copied.
-- @param buffer The global buffer.
function cut(buffer) end

---
-- Deletes text from the caret to the beginning of the line.
-- @param buffer The global buffer.
function del_line_left(buffer) end

---
-- Deletes text from the caret to the end of the line.
-- @param buffer The global buffer.
function del_line_right(buffer) end

---
-- Deletes the word to the left of the caret, including any leading non-word
-- characters.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function del_word_left(buffer) end

---
-- Deletes the word to the right of the caret, including any trailing non-word
-- characters.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function del_word_right(buffer) end

---
-- Deletes the word to the right of the caret, excluding any trailing non-word
-- characters.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function del_word_right_end(buffer) end

---
-- Deletes the selected text or the character behind the caret.
-- @param buffer The global buffer.
function delete_back(buffer) end

---
-- Deletes the selected text or the character behind the caret unless the caret
-- is at the beginning of a line.
-- @param buffer The global buffer.
function delete_back_not_line(buffer) end

---
-- Deletes the range of text from *pos* to *pos* + *length* in the buffer.
-- @param buffer The global buffer.
-- @param pos The start position of the range of text in *buffer* to delete.
-- @param length The number of characters in the range of text to delete.
function delete_range(buffer, pos, length) end

---
-- Returns the actual line number of displayed line number *display_line*,
-- taking hidden lines into account.
-- If *display_line* is less than or equal to zero, returns `0`. If
-- *display_line* is greater than or equal to the number of displayed lines,
-- returns `buffer.line_count`.
-- @param buffer The global buffer.
-- @param display_line The display line number to use.
-- @return number
function doc_line_from_visible(buffer, display_line) end

---
-- Moves the caret to the end of the buffer.
-- @param buffer The global buffer.
function document_end(buffer) end

---
-- Moves the caret to the end of the buffer, extending the selection to the new
-- position.
-- @param buffer The global buffer.
function document_end_extend(buffer) end

---
-- Moves the caret to the beginning of the buffer.
-- @param buffer The global buffer.
function document_start(buffer) end

---
-- Moves the caret to the beginning of the buffer, extending selection to the
-- new position.
-- @param buffer The global buffer.
function document_start_extend(buffer) end

---
-- Toggles `buffer.overtype`.
-- @param buffer The global buffer.
function edit_toggle_overtype(buffer) end

---
-- Deletes the undo and redo history and sets `buffer.modify` to `false`.
-- @param buffer The global buffer.
function empty_undo_buffer(buffer) end

---
-- Returns the result of UTF-8-encoded string *string* converted into the
-- buffer's encoding.
-- @param buffer The global buffer.
-- @param string The UTF-8-encoded string to convert.
-- @return number
function encoded_from_utf8(buffer, string) end

---
-- Ends a sequence of actions to undo or redo as a single action.
-- @param buffer The global buffer.
function end_undo_action(buffer) end

---
-- Ensures line number *line* is visible by expanding any fold header lines
-- hiding it.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to ensure visible.
function ensure_visible(buffer, line) end

---
-- Ensures line number *line* is visible by expanding any fold header lines
-- hiding it and applies the vertical caret policy set with
-- `buffer:set_visible_policy()`.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to ensure visible.
function ensure_visible_enforce_policy(buffer, line) end

---
-- Returns the position of column number *column* on line number *line*, taking
-- tab and multi-byte characters into account, or the position at the end of
-- line *line*.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to use.
-- @param column The column number to use.
function find_column(buffer, line, column) end

---
-- Inserts a Form Feed ("\f") character at the caret.
-- @param buffer The global buffer.
function form_feed(buffer) end

---
-- Returns the current line's text and the index of the caret on the line,
-- starting from zero.
-- @param buffer The global buffer.
-- @return string, number
function get_cur_line(buffer) end

---
-- Returns the numeric background color for active hotspots.
-- @param buffer The global buffer.
-- @return number
function get_hotspot_active_back(buffer) end

---
-- Returns the numeric foreground color for active hotspots.
-- @param buffer The global buffer.
-- @return number
function get_hotspot_active_fore(buffer) end

---
-- Returns the line number of the last line after line number *start_line* whose
-- fold level is greater than *level* or the level of *start_line* if *level* is
-- `-1`.
-- @param buffer The global buffer.
-- @param start_line The line number in *buffer* of a header line.
-- @param level The fold level, or `-1` for the level of *start_line*.
function get_last_child(buffer, start_line, level) end

---
-- Returns the text on line number *line*, including end of line characters, and
-- the length of the line.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to use.
-- @return string, number
function get_line(buffer, line) end

---
-- Returns the position of the end of the selected text on line number *line*,
-- or `-1`.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to use.
function get_line_sel_end_position(buffer, line) end

---
-- Returns the position of the beginning of the selected text on line number
-- *line*, or `-1`.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to use.
function get_line_sel_start_position(buffer, line) end

---
-- Returns the selected text and its length.
-- Multiple selections are included in order with no delimiters. Rectangular
-- selections are included from top to bottom with line ending delimiters.
-- Virtual space is not included.
-- @param buffer The global buffer.
-- @return string, number
function get_sel_text(buffer) end

---
-- Returns all of the text in the buffer and its length.
-- @param buffer The global buffer.
function get_text(buffer) end

---
-- Places the caret an anchor at the beginning of line number *line* and scrolls
-- them into view.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to go to.
function goto_line(buffer, line) end

---
-- Places the caret and anchor at position *pos* and scrolls them into view.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to go to.
function goto_pos(buffer, pos) end

---
-- Sets the focus to the buffer's view.
-- @param buffer The global buffer.
function grab_focus(buffer) end

---
-- Hides the range of lines from line number *start_line* to *end_line*.
-- This has no effect on fold levels or fold flags and the first line cannot be
-- hidden.
-- @param buffer The global buffer.
-- @param start_line The start line of the range of lines in *buffer* to hide.
-- @param end_line The end line of the range of lines in *buffer* to hide.
function hide_lines(buffer, start_line, end_line) end

---
-- Do not highlight selected text if *normal* is `true`.
-- @param buffer The global buffer.
-- @param normal Whether or not to draw the normal selection.
function hide_selection(buffer, normal) end

---
-- Moves the caret to the beginning of the current line.
-- @param buffer The global buffer.
function home(buffer) end

---
-- Moves the caret to the beginning of the current wrapped line.
-- @param buffer The global buffer.
function home_display(buffer) end

---
-- Moves the caret to the beginning of the current wrapped line, extending the
-- selection to the new position.
-- @param buffer The global buffer.
function home_display_extend(buffer) end

---
-- Moves the caret to the beginning of the current line, extending selection to
-- the new position.
-- @param buffer The global buffer.
function home_extend(buffer) end

---
-- Moves the caret to beginning of the current line, extending the rectangular
-- selection to the new position.
-- @param buffer The global buffer.
function home_rect_extend(buffer) end

---
-- Moves the caret to beginning of the current wrapped line, or if already
-- there, to the beginning of the actual line.
-- @param buffer The global buffer.
function home_wrap(buffer) end

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

---
-- Returns a bit-mask representing which indicators are on at position *pos*.
-- Bit 0 is set if indicator 0 is on, bit 1 for indicator 1, etc.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to get indicators at.
-- @return number
function indicator_all_on_for(buffer, pos) end

---
-- Clears indicator `buffer.indicator_current` over the range of text from *pos*
-- to *pos* + *clear_length*.
-- @param buffer The global buffer.
-- @param pos The start position of the range of text in *buffer* to clear
--   indicators over.
-- @param clear_length The number of characters in the range of text to clear
--   indicators over.
function indicator_clear_range(buffer, pos, clear_length) end

---
-- Returns the end position of indicator number *indicator*, in the range of `0`
-- to `31`, at position *pos*.
-- @param buffer The global buffer.
-- @param indicator An indicator number in the range of `0` to `31`.
-- @param pos The position in *buffer* of the indicator.
function indicator_end(buffer, indicator, pos) end

---
-- Sets indicator `buffer.indicator_value` or `buffer.indicator_current` over
-- the range of text from *pos* to *pos* + *fill_length*.
-- @param buffer The global buffer.
-- @param pos The start position of the range of text in *buffer* to set
--   indicators over.
-- @param fill_length The number of characters in the range of text to set
--   indicators over.
function indicator_fill_range(buffer, pos, fill_length) end

---
-- Returns the position of the beginning of indicator number *indicator*, in the
-- range of `0` to `31`, at position *pos*.
-- @param buffer The global buffer.
-- @param indicator An indicator number in the range of `0` to `31`.
-- @param pos The position in *buffer* of the indicator.
function indicator_start(buffer, indicator, pos) end

---
-- Returns the value of indicator number *indicator*, in the range of `0` to
-- `31`, at position *pos*.
-- @param buffer The global buffer.
-- @param indicator The indicator number in the range of `0` to `31`.
-- @param pos The position in *buffer* of the indicator.
-- @return number
function indicator_value_at(buffer, indicator, pos) end

---
-- Inserts string *text* at position *pos* or the caret if *pos* is `-1`.
-- If the caret is after the *pos*, it is moved appropriately, but not scrolled
-- into view.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to insert text at, or `-1` for the
--   current position.
-- @param text The text to insert.
function insert_text(buffer, pos, text) end

---
-- Copies the current line to the clipboard.
-- @param buffer The global buffer.
function line_copy(buffer) end

---
-- Cuts the current line to the clipboard.
-- @param buffer The global buffer.
function line_cut(buffer) end

---
-- Deletes the current line.
-- @param buffer The global buffer.
function line_delete(buffer) end

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

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

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

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

---
-- Moves the caret to the end of the current line.
-- @param buffer The global buffer.
function line_end(buffer) end

---
-- Moves the caret to the end of the current wrapped line.
-- @param buffer The global buffer.
function line_end_display(buffer) end

---
-- Moves the caret to the end of the current wrapped line, extending the
-- selection to the new position.
-- @param buffer The global buffer.
function line_end_display_extend(buffer) end

---
-- Moves the caret to the end of the current line, extending the selection to
-- the new position.
-- @param buffer The global buffer.
function line_end_extend(buffer) end

---
-- Moves the caret to the end of the current line, extending the rectangular
-- selection to the new position.
-- @param buffer The global buffer.
function line_end_rect_extend(buffer) end

---
-- Moves the caret to the end of the current wrapped line, or if already there,
-- to the end of the actual line.
-- @param buffer The global buffer.
function line_end_wrap(buffer) end

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

---
-- Returns the line number containing position *pos*.
-- Returns `0` if *pos* is less than 0 or `buffer.line_count` if *pos* is
-- greater than `buffer.length`.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to get the line number of.
-- @return number
function line_from_position(buffer, pos) end

---
-- Returns the number of characters on line number *line*, including end of line
-- characters.
-- To get line length excluding 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 in *buffer* to get the length of.
-- @return number
function line_length(buffer, line) end

---
-- Scroll right *columns* columns and down *lines* lines.
-- Negative values are allowed.
-- @param buffer The global buffer.
-- @param columns The number of columns to scroll horizontally.
-- @param lines The number of lines to scroll vertically.
function line_scroll(buffer, columns, lines) end

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

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

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

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

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

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

---
-- Joins the lines in the target range, inserting spaces in-between joined
-- words.
-- @param buffer The global buffer.
function lines_join(buffer) end

---
-- Splits the lines in the target range into lines of width at most
-- *pixel_width* or the width of the view if *pixel_width* is `0`.
-- @param buffer The global buffer.
-- @param pixel_width The pixel width to split lines at. When `0`, uses the
--   width of the view.
function lines_split(buffer, pixel_width) end

---
-- Converts the selected text to lower case letters.
-- @param buffer The global buffer.
function lower_case(buffer) end

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

---
-- Adds marker number *marker_num*, in the range of `0` to `31`, on line number
-- *line*, returning a marker handle which can be used in
-- `buffer:marker_delete_handle()` and `buffer:marker_line_from_handle()`, or
-- `-1` if the marker cannot be added.
-- @param buffer The global buffer.
-- @param line The line number to add the marker on.
-- @param marker_num The marker number in the range of `0` to `31` to add.
-- @return number
function marker_add(buffer, line, marker_num) end

---
-- Adds the markers specified in the marker bit-mask *marker_mask* to line
-- number *line*.
-- Bit 0 is set to add marker 0, bit 1 for marker 1, etc., up to marker 31.
-- @param buffer The global buffer.
-- @param line The line number to add the markers on.
-- @param marker_mask The mask of markers to set. Set bit 0 to set marker 0, bit
--   1 for marker 1 and so on.
function marker_add_set(buffer, line, marker_mask) end

---
-- Sets the symbol *marker_symbol* shown in the margin for marker number
-- *marker_num*, in the range of `0` to `31`.
-- @param buffer The global buffer.
-- @param marker_num The marker number in the range of `0` to `31` to set
--   *marker_symbol* for.
-- @param marker_symbol The marker symbol: `_SCINTILLA.constants.SC_MARK_*`.
-- @see _SCINTILLA.next_marker_number
function marker_define(buffer, marker_num, marker_symbol) end

---
-- Defines XPM image *pixmap* for marker number *marker_num*, in the range of
-- `0` to `31`.
-- Pixmap markers use the `_SCINTILLA.constants.SC_MARK_PIXMAP` marker symbol.
-- @param buffer The global buffer.
-- @param marker_num The marker number in the range of `0` to `31` to define
--   pixmap *pixmap* for.
-- @param pixmap The string pixmap data.
function marker_define_pixmap(buffer, marker_num, pixmap) end

---
-- Defines RGBA image *pixels* for marker number *marker_num*, in the range of
-- `0` to `31`.
-- RGBA image markers use the `_SCINTILLA.constants.SC_MARK_RGBAIMAGE` marker
-- symbol. The dimensions for *pixels*, `buffer.rgba_image_width` and
-- `buffer.rgba_image_height`, must be already defined. *pixels* is a sequence
-- of 4 byte pixel values (red, blue, green, and alpha) defining the image line
-- by line starting at the top-left pixel.
-- @param buffer The global buffer.
-- @param marker_num The marker number in the range of `0` to `31` to define
--   RGBA data *pixels* for.
-- @param pixels The string 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 marker_define_rgba_image(buffer, marker_num, pixels) end

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

---
-- Deletes marker number *marker_num*, in the range of `0` to `31` or `-1` for
-- all markers, from all lines in the buffer.
-- @param buffer The global buffer.
-- @param marker_num The marker number in the range of `0` to `31` to delete
--   from all lines, or `-1` to delete all markers from all lines.
function marker_delete_all(buffer, marker_num) end

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

---
-- Highlights the margin fold markers for the current fold block if *enabled* is
-- `true`.
-- @param buffer The global buffer.
-- @param enabled Whether or not to enable highlight.
function marker_enable_highlight(buffer, enabled) end

---
-- Returns a bit-mask representing which markers are set line number *line*.
-- Bit 0 is set if marker 0 is set, bit 1 for marker 1, etc.
-- @param buffer The global buffer.
-- @param line The line number to get markers on.
-- @return number.
function marker_get(buffer, line) end

---
-- Returns the line number the marker with handle *handle*, returned by
-- `buffer:marker_add()`, is on, or `-1`.
-- @param buffer The global buffer.
-- @param handle The identifier of a marker returned by `buffer:marker_add()`.
-- @return number
function marker_line_from_handle(buffer, handle) end

---
-- Returns the first line number starting at line number *start_line* that has
-- all of the markers represented by marker bit-mask *marker_mask* set on, or
-- `-1`.
-- Bit 0 is set if marker 0 is set, bit 1 for marker 1, etc., up to marker 31.
-- @param buffer The global buffer.
-- @param start_line The start line to search from.
-- @param marker_mask The mask of markers to find. Set bit 0 to find marker 0,
--   bit 1 for marker 1 and so on.
-- @return number
function marker_next(buffer, start_line, marker_mask) end

---
-- Returns the last line number before or on line number *start_line* that has
-- all of the markers represented by marker bit-mask *marker_mask* set on, or
-- `-1`.
-- Bit 0 is set if marker 0 is set, bit 1 for marker 1, etc., up to marker 31.
-- @param buffer The global buffer.
-- @param start_line The start line to search from.
-- @param marker_mask The mask of markers to find. Set bit 0 to find marker 0,
--   bit 1 for marker 1 and so on.
-- @return number
function marker_previous(buffer, start_line, marker_mask) end

---
-- Returns the symbol defined for marker number *marker_num*, in the range of
-- `0` to `31`, used in `buffer:marker_define()`,
-- `buffer:marker_define_pixmap()`, or `buffer:marker_define_rgba_image()`.
-- @param buffer The global buffer.
-- @param marker_num The marker number in the range of `0` to `31` to get the
--   symbol of.
-- @return number
function marker_symbol_defined(buffer, marker_num) end

---
-- Moves the caret to be visible inside the view if it is not already, removing
-- any selections.
-- @param buffer The global buffer.
function move_caret_inside_view(buffer) end

---
-- Moves the selected lines down one line.
-- @param buffer The global buffer.
function move_selected_lines_down(buffer) end

---
-- Moves the selected lines up one line.
-- @param buffer The global buffer.
function move_selected_lines_up(buffer) end

---
-- Inserts a new line character(s) at the caret depending on the end of line
-- mode.
-- @param buffer The global buffer.
function new_line(buffer) end

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

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

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

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

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

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

---
-- Moves the caret one paragraph down.
-- Paragraphs are surrounded by one or more blank lines.
-- @param buffer The global buffer.
function para_down(buffer) end

---
-- Moves the caret one paragraph down, extending the selection to the new
-- position.
-- Paragraphs are surrounded by one or more blank lines.
-- @param buffer The global buffer.
function para_down_extend(buffer) end

---
-- Moves the caret one paragraph up.
-- Paragraphs are surrounded by one or more blank lines.
-- @param buffer The global buffer.
function para_up(buffer) end

---
-- Moves the caret one paragraph up, extending the selection to the new
-- position.
-- Paragraphs are surrounded by one or more blank lines.
-- @param buffer The global buffer.
function para_up_extend(buffer) end

---
-- Pastes the contents of the clipboard into the buffer, replacing the selected
-- text depending on `buffer.multi_paste`.
-- @param buffer The global buffer.
function paste(buffer) end

---
-- Returns the x-coordinate in the view of position *pos*.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to get the x-coordinate in the view of.
-- @return number
function point_x_from_position(buffer, pos) end

---
-- Returns the y-coordinate in the view of position *pos*.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to get the y-coordinate in the view of.
-- @return number
function point_y_from_position(buffer, pos) end

---
-- Returns the position of the next character after position *pos*, taking code
-- page into account, or `buffer.length - 1`.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to get the position after from.
function position_after(buffer, pos) end

---
-- Returns the position of the previous character before position *pos*, taking
-- code page into account, or `0`.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* to get the position before from.
-- @return number
function position_before(buffer, pos) end

---
-- Returns the position at the beginning of line number *line*.
-- Returns `-1` if *line* is greater than `buffer.line_count`.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to get the beginning position for.
-- @return number
function position_from_line(buffer, line) end

---
-- Returns the position closest to view coordinates *x* and *y*, which may be
-- in-between multi-byte characters.
-- @param buffer The global buffer.
-- @param x The x-coordinate in the view to use.
-- @param y The y-coordinate in the view to use.
-- @return number
function position_from_point(buffer, x, y) end

---
-- Returns the position closest to view coordinates *x* and *y*, which may be
-- in-between multi-byte characters, or `-1` if the point is outside the window
-- or not close to any text.
-- @param buffer The global buffer.
-- @param x The x-coordinate in the view to use.
-- @param y The y-coordinate in the view to use.
-- @return number
function position_from_point_close(buffer, x, y) end

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

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

---
-- Registers RGBA image *pixels* to type number *type* for use in autocompletion
-- lists.
-- The dimensions for *pixels*, `buffer.rgba_image_width` and
-- `buffer.rgba_image_height`, must be already defined. *pixels* is a sequence
-- of 4 byte pixel values (red, blue, green, and alpha) defining the image line
-- by line starting at the top-left pixel.
-- @param buffer The global buffer.
-- @param type Integer type to register the image with.
-- @param pixels The RGBA data as described in
--   `buffer:marker_define_rgba_image()`.
function register_rgba_image(buffer, type, pixels) end

---
-- Replaces the selected text with string *text*, scrolling the caret into view.
-- @param buffer The global buffer.
-- @param text The text to replace the selected text with.
function replace_sel(buffer, text) end

---
-- Replaces the text in the target range with string *text*, returning the
-- length of *text*.
-- The recommended way to delete text in the buffer is to set the target to the
-- text to be removed, and to call this function with an empty string.
-- @param buffer The global buffer.
-- @param text The text to replace the target range with.
-- @return number
function replace_target(buffer, text) end

---
-- Replaces the text in the target range with string *text* after replacing any
-- "\d" sequences, where `d` is a number in the range of `1` to `9`, with the
-- tag match values from the regular expression or the entire match for "\0",
-- returning the length of the replacement text.
-- @param buffer The global buffer.
-- @param text The text to replace the target range with.
-- @return number
function replace_target_re(buffer, text) end

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

---
-- Scrolls the caret into view based on the policies set with
-- `buffer:set_x_caret_policy()` and `buffer:set_y_caret_policy()`.
-- @param buffer The global buffer.
-- @see set_x_caret_policy
-- @see set_y_caret_policy
function scroll_caret(buffer) end

---
-- Scroll to the end of the buffer without moving the caret.
-- @param buffer The global buffer.
function scroll_to_end(buffer) end

---
-- Scroll to the beginning of the buffer without moving the caret.
-- @param buffer The global buffer.
function scroll_to_start(buffer) end

---
-- Sets the current position to anchor subsequent searches with
-- `buffer:search_next()` and `buffer:search_prev()`.
-- @param buffer The global buffer.
function search_anchor(buffer) end

---
-- Searches for the first occurrence of string *text* in the target range
-- bounded by `buffer.target_start` and `buffer.target_end` using search flags
-- `buffer.search_flags` and, if found, sets the new target range to that
-- occurrence, returning its position or `-1` otherwise.
-- @param buffer The global buffer.
-- @param text The text to search the target range for.
-- @return number
function search_in_target(buffer, text) end

---
-- Searches for and selects the first occurrence of string *text* starting at
-- the search anchor using search flags *flags*, returning the position of the
-- occurrence or `-1`.
-- Selected text is not scrolled into view.
-- @param buffer The global buffer.
-- @param flags The search flags to use. See `buffer.search_flags`.
-- @param text The text to search for.
-- @return number
-- @see search_flags
function search_next(buffer, flags, text) end

---
-- Searches for and selects the last occurrence of string *text* before the
-- search anchor using search flags *flags*, returning the position of the
-- occurrence or `-1`.
-- @param buffer The global buffer.
-- @param flags The search flags to use. See `buffer.search_flags`.
-- @param text The text to search for.
-- @return number
-- @see search_flags
function search_prev(buffer, flags, text) end

---
-- Selects all of the text in the buffer without scrolling the view.
-- @param buffer The global buffer.
function select_all(buffer) end

---
-- Duplicates the selected text or the current line.
-- @param buffer The global buffer.
function selection_duplicate(buffer) end

---
-- Resets the set of whitespace and word characters to their default characters.
-- @param buffer The global buffer.
-- @see whitespace_chars
-- @see word_chars
function set_chars_default(buffer) end

---
-- Sets the current position to position *pos* without scrolling the view,
-- removing any selections.
-- @param buffer The buffer
-- @param pos The position in *buffer* to move to.
function set_empty_selection(buffer, pos) end

---
-- Overrides the default color of the fold margin with *color*, in "0xBBGGRR"
-- format, if *use_setting* is `true`.
-- @param buffer The global buffer.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_fold_margin_colour(buffer, use_setting, color) end

---
-- Overrides the default highlight color of the fold margin with *color*, in
-- "0xBBGGRR" format, if *use_setting* is `true`.
-- @param buffer The global buffer.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_fold_margin_hi_colour(buffer, use_setting, color) end

---
-- Overrides the default background color of active hotspots with *color*, in
-- "0xBBGGRR" format, if *use_setting* is `true`.
-- @param buffer The global buffer.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_hotspot_active_back(buffer, use_setting, color) end

---
-- Overrides the default foreground color of active hotspots with *color*, in
-- "0xBBGGRR" format, if *use_setting* is `true`.
-- @param buffer The global buffer.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_hotspot_active_fore(buffer, use_setting, color) end

---
-- Sets the length of *string* in `buffer:encoded_from_utf8()` to *bytes*.
-- @param buffer The global buffer.
-- @param bytes The number of bytes to encode, or `-1` for measuring to first
--   null byte.
function set_length_for_encode(buffer, bytes) end

---
-- Tells Scintilla the buffer has no unsaved changes.
-- @param buffer The global buffer.
function set_save_point(buffer) end

---
-- Selects the range of text from *start_pos* to *end_pos* in the buffer,
-- scrolling the selected text into view.
-- @param buffer The global buffer.
-- @param start_pos The start position of the range of text in *buffer* to
--   select. If negative, it means the end of the buffer.
-- @param end_pos The end position of the range of text in *buffer* to select.
--   If negative, it means remove any selection (i.e. set the `anchor` to the
--   same position as `current_pos`).
function set_sel(buffer, start_pos, end_pos) end

---
-- Overrides the default background color of all selected text with *color*, in
-- "0xBBGGRR" format, if *use_setting* is `true`.
-- @param buffer The global buffer.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_sel_back(buffer, use_setting, color) end

---
-- Overrides the default foreground color of all selected text with *color*, in
-- "0xBBGGRR" format, if *use_setting* is `true`.
-- @param buffer The global buffer.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_sel_fore(buffer, use_setting, color) end

---
-- Selects the range of text from *anchor* to *caret* in the buffer, removing
-- all other selections.
-- @param buffer The global buffer.
-- @param caret The caret position of the range of text to select in *buffer*.
-- @param anchor The anchor position of the range of text to select in *buffer*.
function set_selection(buffer, caret, anchor) end

---
-- Sets the style of the next *length* characters, from the current styling
-- position, to style number *style*, in the range from `0` to `255`, and
-- increments the styling position by *length*.
-- @param buffer The global buffer.
-- @param length The number of characters to style.
-- @param style The style number to set.
function set_styling(buffer, length, style) end

---
-- Replaces all of the text in the buffer with string *text*.
-- @param buffer The global buffer.
-- @param text The text to set.
function set_text(buffer, text) end

---
-- Sets the visible policy bit-mask *visible_policy* for displaying lines using
-- `buffer:ensure_visible_enforce_policy()` to *visible_slop* number of lines
-- from the bottom of the view.
-- It is similar in operation to `buffer:set_y_caret_policy()`.
-- @param buffer The global buffer.
-- @param visible_policy The combination of `_SCINTILLA.constants.VISIBLE_SLOP`
--   (0x01) and `_SCINTILLA.constants.VISIBLE_STRICT` (0x04) policy flags to set.
-- @param visible_slop The slop value to use.
function set_visible_policy(buffer, visible_policy, visible_slop) end

---
-- Overrides the background color of whitespace with *color*, in "0xBBGGRR"
-- format, if *use_setting* is `true`.
-- @param buffer The global buffer.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_whitespace_back(buffer, use_setting, color) end

---
-- Overrides the foreground color of whitespace with *color*, in "0xBBGGRR"
-- format, if *use_setting* is `true`.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_whitespace_fore(buffer, use_setting, color) end

---
-- Set the way the caret is kept visible when going sideways.
-- The exclusion zone is given in pixels.
-- @param buffer The global buffer.
-- @param caret_policy The combination of `_SCINTILLA.constants.CARET_SLOP`
--   (0x01), `_SCINTILLA.constants.CARET_STRICT` (0x04),
--   `_SCINTILLA.constants.CARET_EVEN` (0x08), and
--   `_SCINTILLA.constants.CARET_JUMPS` (0x10) policy flags to set.
-- @param caret_slop The slop value to use.
function 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 The combination of `_SCINTILLA.constants.CARET_SLOP`
--   (0x01), `_SCINTILLA.constants.CARET_STRICT` (0x04),
--   `_SCINTILLA.constants.CARET_EVEN` (0x08), and
--   `_SCINTILLA.constants.CARET_JUMPS` (0x10) policy flags to set.
-- @param caret_slop The slop value to use.
function set_y_caret_policy(buffer, caret_policy, caret_slop) end

---
-- Shows the range of lines from line number *start_line* to *end_line*.
-- This has no effect on fold levels or fold flags and the first line cannot be
-- hidden.
-- @param buffer The global buffer.
-- @param start_line The start line of the range of lines in *buffer* to show.
-- @param end_line The end line of the range of lines in *buffer* to show.
function show_lines(buffer, start_line, end_line) end

---
-- Begin styling at position *position* with the 8-bit styling bit-mask *mask*
-- that determines which style bits can be set with `buffer:set_styling()`.
-- @param buffer The global buffer.
-- @param position The position in *buffer* to start styling at.
-- @param mask The bit mask of style bits that can be set when styling.
-- @usage buffer:start_styling(0, 0xFF)
function start_styling(buffer, position, mask) end

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

---
-- Like `buffer:stuttered_page_down()`, but extends the selection to the new
-- position.
-- @param buffer The global buffer.
function stuttered_page_down_extend(buffer) end

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

---
-- Like `buffer:stuttered_page_up()`, but extends the selection to the new
-- position.
-- @param buffer The global buffer.
function stuttered_page_up_extend(buffer) end

---
-- Sets all styles to have the same properties as
-- `_SCINTILLA.constants.STYLE_DEFAULT`.
-- @param buffer The global buffer.
function style_clear_all(buffer) end

---
-- Resets `_SCINTILLA.constants.STYLE_DEFAULT` to its initial state.
-- @param buffer The global buffer.
function style_reset_default(buffer) end

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

---
-- Indents the selected lines, replaces the selected text on a line with a Tab
-- character ("\t"), or inserts a Tab character at the caret.
-- @param buffer The global buffer.
function tab(buffer) end

---
-- Returns the result of the text in the target range converted from the
-- buffer's code page into UTF-8.
-- @param buffer The global buffer.
function target_as_utf8(buffer) end

---
-- Sets the beginning and end positions of the target range to be the beginning
-- and end positions of the main selection.
-- @param buffer The global buffer.
function target_from_selection(buffer) end

---
-- Returns the height in pixels of line number *line*.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to get the pixel height of.
-- @return number
function text_height(buffer, line) end

---
-- Returns the width in pixels of string *text* styled with style number
-- *style_num*, in the range of `0` to `255`.
-- @param buffer The global buffer.
-- @param style_num The style number between `0` and `255` to use.
-- @param text The text to measure the width of.
-- @return number
function text_width(buffer, style_num, text) end

---
-- Cycles between caret sticky option settings
-- `_SCINTILLA.constants.SC_CARETSTICKY_ON`,
-- `_SCINTILLA.constants.SC_CARETSTICKY_WHITESPACE`, and
-- `_SCINTILLA.constants.SC_CARETSTICKY_OFF`.
-- @param buffer The global buffer.
-- @see caret_sticky
function toggle_caret_sticky(buffer) end

---
-- Toggles the fold state of a fold header line between expanded, where all
-- of its child lines are displayed, and contracted, where all of its child
-- lines are hidden.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to toggle the fold on.
function toggle_fold(buffer, line) end

---
-- Undoes the most recent action.
-- @param buffer The global buffer.
function undo(buffer) end

---
-- Converts the selected text to upper case letters.
-- @param buffer The global buffer.
function upper_case(buffer) end

---
-- Displays a list from *item_list*, a sorted string whose items are delimited
-- by `buffer.auto_c_separator` characters, using the list identifier number
-- *list_type* which is greater than zero and sent in a `USER_LIST_SELECTION`
-- event after selecting an item.
-- @param buffer The global buffer.
-- @param list_type The list identifier number greater than zero to use.
-- @param item_list The sorted string of words to show, separated by
--   `buffer.auto_c_separator` characters (initially spaces).
-- @see _SCINTILLA.next_user_list_type
function user_list_show(buffer, list_type, item_list) end

---
-- Moves the caret to the first visible character on the current line, or if
-- already there, to the beginning of the current line.
-- @param buffer The global buffer.
function vc_home(buffer) end

---
-- Moves the caret to the first visible character on the current wrapped line,
-- or if already there, to the beginning of the current wrapped line.
-- @param buffer The global buffer.
function vc_home_display(buffer) end

---
-- Like `buffer:vc_home_display()`, but extends the selection to the new
-- position.
-- @param buffer The global buffer.
function vc_home_display_extend(buffer) end

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

---
-- Like `buffer:vc_home()`, but extends the rectangular selection to the new
-- position.
-- @param buffer The global buffer.
function vc_home_rect_extend(buffer) end

---
-- Moves the caret to the first visible character on the wrapped line, or if
-- already there, to the beginning of the actual line.
-- @param buffer The global buffer.
function vc_home_wrap(buffer) end

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

---
-- Centers current line in the view.
-- @param buffer The global buffer.
function vertical_centre_caret(buffer) end

---
-- Returns the displayed line number of actual line number *line*, taking hidden
-- lines into account, or `-1` if *line* is outside the range of lines in the
-- buffer.
-- Lines can occupy more than one display line if they wrap.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to use.
-- @return number
function visible_from_doc_line(buffer, line) end

---
-- Returns the position of the end of the word at position *pos*.
-- `buffer.word_chars` contains word characters. If *pos* has a non-word
-- character to its right and *only_word_chars* is `false`, returns the position
-- of the first word character.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* of the word.
-- @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 buffer.
function word_end_position(buffer, pos, only_word_chars) end

---
-- Moves the caret left one word.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_left(buffer) end

---
-- Moves the caret left one word, positioning the caret at the end of the
-- previous word.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_left_end(buffer) end

---
-- Like `buffer:word_left_end()`, but extends the selection to the new position.
-- @param buffer The global buffer.
function word_left_end_extend(buffer) end

---
-- Moves the caret left one word, extending the selection to the new position.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_left_extend(buffer) end

---
-- Moves to the previous underscore or change in capitalization within the
-- current word.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_part_left(buffer) end

---
-- Moves to the previous underscore or change in capitalization within the
-- current word, extending the selection to the new position.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_part_left_extend(buffer) end

---
-- Moves to the next underscore or change in capitalization within the current
-- word.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_part_right(buffer) end

---
-- Moves to the next underscore or change in capitalization within the current
-- word, extending the selection to the new position.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_part_right_extend(buffer) end

---
-- Moves the caret right one word.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_right(buffer) end

---
-- Moves the caret right one word, positioning the cursor at the end of the
-- current word.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_right_end(buffer) end

---
-- Like `buffer:word_right_end()`, but extends the selection to the new
-- position.
-- @param buffer The global buffer.
function word_right_end_extend(buffer) end

---
-- Moves the caret right one word, extending the selection to the new position.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_right_extend(buffer) end

---
-- Returns the position of the beginning of the word at position *pos*.
-- `buffer.word_chars` contains word characters. If *pos* has a non-word
-- character to its left and *only_word_chars* is `false`, returns the position
-- of the last word character.
-- @param buffer The global buffer.
-- @param pos The position in *buffer* of the word.
-- @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 buffer.
function word_start_position(buffer, pos, only_word_chars) end

---
-- Returns the number of wrapped lines needed to display line number *line*.
-- @param buffer The global buffer.
-- @param line The line number in *buffer* to use.
-- @return number
function wrap_count(buffer, line) end

---
-- Increases the size of all fonts by one point, up to 20.
-- @param buffer The global buffer.
function zoom_in(buffer) end

---
-- Decreases the size of all fonts by one point, down to -10.
-- @param buffer The global buffer.
function zoom_out(buffer) end

-- External functions.

---
-- Ensures the buffer is the global one, `_G.buffer`, throwing an error
-- otherwise.
-- This function must be called in all buffer functions because only the global
-- buffer can be worked with.
-- @param buffer The buffer to check.
-- @see _G._G.buffer
function check_global(buffer) end

---
-- Deletes the buffer.
-- **Do not call this function.** Call `buffer:close()` instead. Emits a
-- `BUFFER_DELETED` event.
-- @param buffer The global buffer.
-- @see events.BUFFER_DELETED
function delete(buffer) end

---
-- Returns the range of text from *start_pos* to *end_pos* in the buffer.
-- @param buffer The global buffer.
-- @param start_pos The start position of the range of text to get in *buffer*.
-- @param end_pos The end position of the range of text to get in *buffer*.
function text_range(buffer, start_pos, end_pos) end

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

---
-- Sets the encoding for the buffer to *encoding*, converting its contents from
-- the old encoding to the new one.
-- @param buffer The global buffer.
-- @param encoding The string encoding to set. Valid encodings are ones that GNU
--   iconv accepts.
-- @usage buffer.set_encoding(buffer, 'ASCII')
function set_encoding(buffer, encoding) end

---
-- Saves the buffer to the file.
-- Emits `FILE_BEFORE_SAVE` and `FILE_AFTER_SAVE` events.
-- @param buffer The global buffer.
-- @see _G.events
function save(buffer) end

---
-- Saves the buffer to the *utf8_filename* or user-specified filename.
-- Emits a `FILE_SAVED_AS` event.
-- @param buffer The global buffer.
-- @param utf8_filename The new filepath to save the buffer to. Must be UTF-8
--   encoded.
-- @see _G.events
function save_as(buffer, utf8_filename) end

---
-- Closes the buffer, prompting the user to continue if there are unsaved
-- changes, and returns `true` if the buffer was closed.
-- @param buffer The global buffer.
-- @return `true` if the buffer was closed; `nil` otherwise.
function close(buffer) end

---
-- Sets the name of the lexer used by the buffer to *lang*, loading its
-- language-specific module if the module exists.
-- @param buffer The global buffer.
-- @param lang The string language name to set.
-- @usage buffer.set_lexer(buffer, 'language_name')
function set_lexer(buffer, lang) end

---
-- Returns the name of the lexer used by the buffer, or the name of the lexer at
-- the current position in a multiple-language lexer if *current* is `true`.
-- @param buffer The global buffer.
-- @param current Whether or not to get the lexer at the current caret position
--   in multi-language lexers. The default is `false` and returns the parent
--   lexer.
function get_lexer(buffer, current) end

---
-- Returns the name of style number *style_num*, in the range of `0` to `255`.
-- @param buffer The global buffer.
-- @param style_num The style number from `0` to `255` to get the name of.
-- @see buffer.style_at
function get_style_name(buffer, style_num) end

-- Unused Fields.
--   * status
--   * mouse_down_captures
--   * focus
--   * use_palette
--   * font_quality
--   * keys_unicode
--   * doc_pointer
--   * mod_event_mask
--   * paste_convert_endings
--   * direct_function
--   * direct_pointer
--   * character_pointer
--   * get_range_pointer
--   * field gap_position
--   * 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
--   * use_pop_up
--   * start_record
--   * stop_record
--   * create_document
--   * add_ref_document
--   * release_document
--   * margin_set_styles
--   * margin_get_styles
--   * annotation_set_styles
--   * annotation_get_styles
--   * add_undo_action
--   * find_indicator_show
--   * find_indicator_flash
--   * find_indicator_hide
--   * load_lexer_library
--   * property_names
--   * property_type
--   * describe_property
--   * describe_key_word_sets
--   * create_loader
--   * private_lexer_call