Mercurial > vim
comparison src/vim.h @ 28773:d770568e6c98 v8.2.4911
patch 8.2.4911: the mode #defines are not clearly named
Commit: https://github.com/vim/vim/commit/249591057b4840785c50e41dd850efb8a8faf435
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 7 20:01:16 2022 +0100
patch 8.2.4911: the mode #defines are not clearly named
Problem: The mode #defines are not clearly named.
Solution: Prepend MODE_. Renumber them to put the mapped modes first.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 07 May 2022 21:15:06 +0200 |
parents | 2655935b5ccc |
children | a8c2bd5fc727 |
comparison
equal
deleted
inserted
replaced
28772:7b07ca0bb292 | 28773:d770568e6c98 |
---|---|
665 | 665 |
666 // special attribute addition: Put message in history | 666 // special attribute addition: Put message in history |
667 #define MSG_HIST 0x1000 | 667 #define MSG_HIST 0x1000 |
668 | 668 |
669 /* | 669 /* |
670 * values for State | 670 * Values for State. |
671 * | 671 * |
672 * The lower bits up to 0x20 are used to distinguish normal/visual/op_pending | 672 * The lower bits up to 0x80 are used to distinguish normal/visual/op_pending |
673 * and cmdline/insert+replace mode. This is used for mapping. If none of | 673 * /cmdline/insert/replace/terminal mode. This is used for mapping. If none |
674 * these bits are set, no mapping is done. | 674 * of these bits are set, no mapping is done. See the comment above do_map(). |
675 * The upper bits are used to distinguish between other states. | 675 * The upper bits are used to distinguish between other states and variants of |
676 */ | 676 * the base modes. |
677 #define NORMAL 0x01 // Normal mode, command expected | 677 */ |
678 #define VISUAL 0x02 // Visual mode - use get_real_state() | 678 #define MODE_NORMAL 0x01 // Normal mode, command expected |
679 #define OP_PENDING 0x04 // Normal mode, operator is pending - use | 679 #define MODE_VISUAL 0x02 // Visual mode - use get_real_state() |
680 #define MODE_OP_PENDING 0x04 // Normal mode, operator is pending - use | |
680 // get_real_state() | 681 // get_real_state() |
681 #define CMDLINE 0x08 // Editing command line | 682 #define MODE_CMDLINE 0x08 // Editing the command line |
682 #define INSERT 0x10 // Insert mode | 683 #define MODE_INSERT 0x10 // Insert mode, also for Replace mode |
683 #define LANGMAP 0x20 // Language mapping, can be combined with | 684 #define MODE_LANGMAP 0x20 // Language mapping, can be combined with |
684 // INSERT and CMDLINE | 685 // MODE_INSERT and MODE_CMDLINE |
685 | 686 #define MODE_SELECT 0x40 // Select mode, use get_real_state() |
686 #define REPLACE_FLAG 0x40 // Replace mode flag | 687 #define MODE_TERMINAL 0x80 // Terminal mode |
687 #define REPLACE (REPLACE_FLAG + INSERT) | 688 |
688 #define VREPLACE_FLAG 0x80 // Virtual-replace mode flag | 689 #define MAP_ALL_MODES 0xff // all mode bits used for mapping |
689 #define VREPLACE (REPLACE_FLAG + VREPLACE_FLAG + INSERT) | 690 |
690 #define LREPLACE (REPLACE_FLAG + LANGMAP) | 691 #define REPLACE_FLAG 0x100 // Replace mode flag |
691 | 692 #define MODE_REPLACE (REPLACE_FLAG | MODE_INSERT) |
692 #define NORMAL_BUSY (0x100 + NORMAL) // Normal mode, busy with a command | 693 #define VREPLACE_FLAG 0x200 // Virtual-replace mode flag |
693 #define HITRETURN (0x200 + NORMAL) // waiting for return or command | 694 #define MODE_VREPLACE (REPLACE_FLAG | VREPLACE_FLAG | MODE_INSERT) |
694 #define ASKMORE 0x300 // Asking if you want --more-- | 695 #define MODE_LREPLACE (REPLACE_FLAG | MODE_LANGMAP) |
695 #define SETWSIZE 0x400 // window size has changed | 696 |
696 #define ABBREV 0x500 // abbreviation instead of mapping | 697 #define MODE_NORMAL_BUSY (0x1000 | MODE_NORMAL) |
697 #define EXTERNCMD 0x600 // executing an external command | 698 // Normal mode, busy with a command |
698 #define SHOWMATCH (0x700 + INSERT) // show matching paren | 699 #define MODE_HITRETURN (0x2000 | MODE_NORMAL) |
699 #define CONFIRM 0x800 // ":confirm" prompt | 700 // waiting for return or command |
700 #define SELECTMODE 0x1000 // Select mode, only for mappings | 701 #define MODE_ASKMORE 0x3000 // Asking if you want --more-- |
701 #define TERMINAL 0x2000 // Terminal mode | 702 #define MODE_SETWSIZE 0x4000 // window size has changed |
703 #define MODE_EXTERNCMD 0x5000 // executing an external command | |
704 #define MODE_SHOWMATCH (0x6000 | MODE_INSERT) // show matching paren | |
705 #define MODE_CONFIRM 0x7000 // ":confirm" prompt | |
702 #define MODE_ALL 0xffff | 706 #define MODE_ALL 0xffff |
703 | 707 |
704 #define MODE_MAX_LENGTH 4 // max mode length returned in mode() | 708 #define MODE_MAX_LENGTH 4 // max mode length used by get_mode(), |
705 | 709 // including the terminating NUL |
706 // all mode bits used for mapping | |
707 #define MAP_ALL_MODES (0x3f | SELECTMODE | TERMINAL) | |
708 | 710 |
709 // directions | 711 // directions |
710 #define FORWARD 1 | 712 #define FORWARD 1 |
711 #define BACKWARD (-1) | 713 #define BACKWARD (-1) |
712 #define FORWARD_FILE 3 | 714 #define FORWARD_FILE 3 |
2482 | 2484 |
2483 #ifdef IN_PERL_FILE | 2485 #ifdef IN_PERL_FILE |
2484 /* | 2486 /* |
2485 * Avoid clashes between Perl and Vim namespace. | 2487 * Avoid clashes between Perl and Vim namespace. |
2486 */ | 2488 */ |
2487 # undef NORMAL | |
2488 # undef STRLEN | 2489 # undef STRLEN |
2489 # undef FF | 2490 # undef FF |
2490 # undef OP_DELETE | 2491 # undef OP_DELETE |
2491 # undef OP_JOIN | 2492 # undef OP_JOIN |
2492 // remove MAX and MIN, included by glib.h, redefined by sys/param.h | 2493 // remove MAX and MIN, included by glib.h, redefined by sys/param.h |