figure_editor
figure_editor, a code editor (code_editor_object) with highlighting, marks, completion and find, and a text diff.
The editor is ImGuiColorTextEdit (the goossens fork, MIT, vendored in third_party/ImGuiColorTextEdit) with FIGURE's own glue (native/figure_editor.cpp): it draws through Dear ImGui only, so window, headless and remote modes show the same pixels. Text is UTF-8; lines and columns are numbered from 1, columns in characters. Everything is polled: ed%draw returns true on the frame the user changed the text, ed%completing while the completion popup is open.
type(code_editor_object) :: ed
call ed%init(code_language('input')) ! key = value files; code_language('fortran') for Fortran
call ed%set_text(text)
call ed%set_completions(['reynolds number', 'save frequency '])
... every frame, inside a window:
if (ed%draw('editor')) call validate(ed%text()) ! the user changed it: check it again
call ed%clear_marks()
call ed%mark(3, 'error', 'reynolds number must be positive')A language (language_object) is data: keywords, types, comments, strings, numbers, case, and a key = value mode; code_language gives the shipped ones (Fortran, input files, plain text) and the fork's own (C, C++, Python, JSON, Markdown, ...). code_diff draws the difference of two texts, code_diff_lines reports the lines that differ.
Source: src/lib/figure_editor.F90
Dependencies
Contents
- language_object
- code_editor_object
- fig_editor_create
- fig_editor_language
- fig_editor_set_text
- fig_editor_string
- fig_editor_draw
- fig_editor_mark
- fig_editor_clear_marks
- fig_editor_mark_of
- fig_editor_goto
- fig_editor_find
- fig_editor_replace
- fig_editor_cursor
- fig_editor_selection
- fig_editor_select
- fig_editor_insert
- fig_editor_completions
- fig_editor_completing
- fig_editor_option
- fig_editor_undo
- fig_editor_info
- fig_editor_focus
- fig_editor_line_rect
- fig_code_diff
- fig_code_diff_lines
- fig_editor_destroy
- language_init
- editor_init
- editor_destroy
- editor_set_language
- editor_set_text
- editor_mark
- editor_clear_marks
- editor_goto
- editor_focus
- editor_cursor
- editor_select
- editor_insert
- editor_set_completions
- editor_read_only
- editor_set_options
- code_diff
- code_diff_lines
- joined
- split_lines
- language_name
- code_language
- editor_is_initialized
- editor_text
- editor_line_count
- editor_draw
- editor_mark_of
- editor_find
- editor_replace
- editor_selection
- editor_word_at_cursor
- editor_completing
- editor_is_read_only
- editor_undo
- editor_redo
- editor_line_rect
- alive
- editor_string
- pack_language
- lower
- fortran_keywords
- fortran_types
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
LF | character(len=*) | parameter | Line feed. |
US | character(len=*) | parameter | Field separator of a packed language. The fork's own languages, by the names code_language takes. |
FORK_LANGUAGES | character(len=*) | parameter |
Derived Types
language_object
A language the editor highlights: lang%init(name, ...), or one of code_language's. Default: plain text.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
name_ | character(len=:) | allocatable | Its name ('': plain text). |
fork | logical | One of the fork's own languages. | |
keywords | character(len=:) | allocatable | Keywords, LF-separated. |
types | character(len=:) | allocatable | Types and attributes, LF-separated. |
comment | character(len=:) | allocatable | Start of a line comment. |
comment_alt | character(len=:) | allocatable | Another start of a line comment. |
block_start | character(len=:) | allocatable | Start of a block comment. |
block_end | character(len=:) | allocatable | End of a block comment. |
preprocessor | character(len=:) | allocatable | The character starting a preprocessor line. |
single_quotes | logical | '...' strings. | |
double_quotes | logical | "..." strings. | |
numbers | logical | Numbers coloured. | |
case_sensitive | logical | Keywords and types by case. | |
key_value | logical | key = value lines. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
init | pass(self) | Define the language. |
name | pass(self) | Its name. |
code_editor_object
A code editor: ed%init([language]), ed%set_text, then ed%draw every frame. Not to be copied (the copy would share the editor). No finaliser, as texture_object: an assignment or a function result would finalise a copy and destroy the editor the original still uses; destroy releases it (at the program's end the system does).
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
handle | integer(kind=c_int) | Native handle (0: none). |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
init | pass(self) | Create the editor. |
destroy | pass(self) | Release it. |
is_initialized | pass(self) | Whether it exists. |
set_language | pass(self) | Highlight another language. |
set_text | pass(self) | Replace the text. |
text | pass(self) | The text. |
line_count | pass(self) | The number of lines. |
draw | pass(self) | Draw the editor as a widget. |
mark | pass(self) | Mark a line with a message. |
clear_marks | pass(self) | Remove every mark. |
mark_of | pass(self) | The mark on a line. |
goto | pass(self) | Move the cursor to a line. |
focus | pass(self) | Give the editor the keyboard. |
find | pass(self) | Select the next occurrence of a text. |
replace | pass(self) | Replace every occurrence of a text. |
cursor | pass(self) | The cursor's line and column. |
selection | pass(self) | The selection. |
select | pass(self) | Select a range. |
insert | pass(self) | Insert a text at the cursor. |
word_at_cursor | pass(self) | The word at the cursor. |
set_completions | pass(self) | The words completion offers. |
completing | pass(self) | The completion popup is open. |
read_only | pass(self) | Make it read-only, or editable. |
is_read_only | pass(self) | Whether it is read-only. |
set_options | pass(self) | Line numbers, tab size, whitespace, the current line. |
undo | pass(self) | Undo the last change. |
redo | pass(self) | Redo the last undone change. |
line_rect | pass(self) | A line's rectangle on the screen. |
Interfaces
fig_editor_create
fig_editor_language
fig_editor_set_text
fig_editor_string
fig_editor_draw
fig_editor_mark
fig_editor_clear_marks
fig_editor_mark_of
fig_editor_goto
fig_editor_find
fig_editor_replace
fig_editor_cursor
fig_editor_selection
fig_editor_select
fig_editor_insert
fig_editor_completions
fig_editor_completing
fig_editor_option
fig_editor_undo
fig_editor_info
fig_editor_focus
fig_editor_line_rect
fig_code_diff
fig_code_diff_lines
fig_editor_destroy
Subroutines
language_init
Define a language: name (shown nowhere, it tells languages apart), the words it colours, its comments and strings. Keywords and types are each trimmed of trailing blanks; matched whole, by case only if case_sensitive. With key_value, a line [section] takes the types' colour and the words before a line's = the keywords'. Status: FIG_ERR_ARGUMENT for an empty name, a keyword or type with a blank or a separator inside, a preprocessor of more than one character. Any thread (it is data).
Attributes: recursive
subroutine language_init(self, name, keywords, types, comment, comment_alt, block_comment, preprocessor, single_quotes, double_quotes, numbers, case_sensitive, key_value, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(language_object) | inout | Language. | |
name | character(len=*) | in | Its name. | |
keywords | character(len=*) | in | optional | Keywords (the keywords' colour). |
types | character(len=*) | in | optional | Types, attributes (the types' colour). |
comment | character(len=*) | in | optional | Start of a line comment (default none). |
comment_alt | character(len=*) | in | optional | Another start of a line comment. |
block_comment | character(len=*) | in | optional | Start and end of a block comment. |
preprocessor | character(len=*) | in | optional | The character of a preprocessor line ('#'). |
single_quotes | logical | in | optional | '...' strings (default true). |
double_quotes | logical | in | optional | "..." strings (default true). |
numbers | logical | in | optional | Numbers coloured (default true). |
case_sensitive | logical | in | optional | By case (default true). |
key_value | logical | in | optional | key = value lines (default false). |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_init
Create the editor (an existing one is destroyed first), empty, highlighting language (default: plain text). It shows line numbers, highlights the current line, matches brackets, and has the fork's find and replace window (ctrl+f; cmd+f on macOS), undo and redo (ctrl+z, ctrl+y), cut, copy and paste with the clipboard. After app%init*. Statuses: FIG_ERR_STATE from a task. The same in every mode.
Attributes: recursive
subroutine editor_init(self, language, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
language | type(language_object) | in | optional | Language (default: plain text). |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_destroy
Release the editor (safe in any state).
Attributes: recursive
subroutine editor_destroy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. |
Call graph
editor_set_language
Highlight language from now on (the text, its marks and its undo history kept). Statuses: FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_set_language(self, language, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
language | type(language_object) | in | Language. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_set_text
Replace the text with text (UTF-8, lines ended by LF or CR LF): the marks and the undo history go, the cursor goes to the start. Statuses: FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_set_text(self, text, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
text | character(len=*) | in | Text. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_mark
Mark line with a message: severity 'error', 'warning' or 'info' tints the line and its number (vermilion, orange, blue) and puts its icon (a crossed circle, a triangle, an "i") beside the number; the message, after its severity's word, is the line's tooltip. A second mark on a line joins the messages and keeps the gravest severity. A mark moves with its line as lines are inserted or deleted above it, and goes with it. Statuses: FIG_ERR_ARGUMENT for another severity or a line outside [1, line_count()]; FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_mark(self, line, severity, message, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
line | integer(kind=int32) | in | Line, from 1. | |
severity | character(len=*) | in | 'error', 'warning' or 'info'. | |
message | character(len=*) | in | Message (UTF-8). | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_clear_marks
Remove every mark. Statuses: FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_clear_marks(self, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_goto
Move the cursor to line (and column, default 1), clamped to the text, and scroll it into view at the next draw; with focus, give the editor the keyboard too. Statuses: FIG_ERR_ARGUMENT for a line or column below 1; FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_goto(self, line, column, focus, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
line | integer(kind=int32) | in | Line, from 1. | |
column | integer(kind=int32) | in | optional | Column, from 1 [characters]. |
focus | logical | in | optional | Give it the keyboard (default false). |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_focus
Give the editor the keyboard at the next draw (as a click in it does). Statuses: FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_focus(self, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_cursor
The cursor's line and column, from 1 (column in characters); 1, 1 before init and from a task.
Attributes: recursive
subroutine editor_cursor(self, line, column)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. | |
line | integer(kind=int32) | out | Line. | |
column | integer(kind=int32) | out | Column [characters]. |
Call graph
editor_select
Select from (first_line, first_column) to just before (last_line, last_column) (from 1, clamped to the text). Statuses: FIG_ERR_ARGUMENT for a position below 1; FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_select(self, first_line, first_column, last_line, last_column, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
first_line | integer(kind=int32) | in | First line. | |
first_column | integer(kind=int32) | in | First column [characters]. | |
last_line | integer(kind=int32) | in | Last line. | |
last_column | integer(kind=int32) | in | Column after the last [characters]. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_insert
Insert text at the cursor, in place of the selection if any, as one change (one undo); the cursor goes after it. Statuses: FIG_ERR_STATE for a read-only editor, before init and from a task.
Attributes: recursive
subroutine editor_insert(self, text, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
text | character(len=*) | in | Text (UTF-8). | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_set_completions
The words completion offers (each trimmed of trailing blanks; none: completion off). While the user types a word, a popup under the cursor lists the words that start with it, then those that contain it, in this order and in any case; up and down choose, tab or enter inserts, escape closes it. In a key = value language a word may hold blanks and dashes ('reynolds number'): the term is then the line's text up to the cursor, its indentation kept. Not in comments and strings. Statuses: FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_set_completions(self, words, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
words | character(len=*) | in | Words. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_read_only
Make the editor read-only (on true: the user moves, selects and copies, nothing changes the text but set_text) or editable again. Statuses: FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_read_only(self, on, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
on | logical | in | Read-only. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_set_options
The editor's options: line_numbers shown (default true), tab_size [characters] in [1, 16] (default 4), whitespace shown as dots and arrows (default false), the current line_highlight (default true). Statuses: FIG_ERR_ARGUMENT for a tab size outside [1, 16]; FIG_ERR_STATE before init and from a task.
Attributes: recursive
subroutine editor_set_options(self, line_numbers, tab_size, whitespace, line_highlight, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
line_numbers | logical | in | optional | Line numbers shown. |
tab_size | integer(kind=int32) | in | optional | Tab size [characters]. |
whitespace | logical | in | optional | Blanks and tabs shown. |
line_highlight | logical | in | optional | The current line highlighted. |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
code_diff
Draw the difference of two texts (UTF-8, lines ended by LF or CR LF) as a widget at the cursor, width x height pixels (0: the available region; negative: up to that distance from its edge), read-only, in IBM Plex Mono: one column with each removed line of left (tinted red, marked -) before the added line of right (green, +), or side_by_side. Lines compared whole, by the diff's algorithm (dtl, the shortest edit script). Drawn by id, as a widget: the comparison is made again only when a text or the language changes; a diff not drawn for 600 frames is forgotten. Statuses: FIG_ERR_ARGUMENT for an empty id, FIG_ERR_STATE with no frame open and from a task. The same in every mode.
Attributes: recursive
subroutine code_diff(id, left, right, side_by_side, language, width, height, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
id | character(len=*) | in | Widget id (unique in the window). | |
left | character(len=*) | in | The old text. | |
right | character(len=*) | in | The new text. | |
side_by_side | logical | in | optional | Two columns (default false: one). |
language | type(language_object) | in | optional | Highlighting (default plain text). |
width | real(kind=real64) | in | optional | Width [pixels] (default 0: the available width). |
height | real(kind=real64) | in | optional | Height [pixels] (default 0: the available height). |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
code_diff_lines
The lines that differ between two texts, as code_diff shows them: added, the lines of right not in left, and removed, the lines of left not in right (from 1, ascending; a changed line is one of each). No frame needed, any mode; a task may call it. Status: always FIG_OK (FIG_ERR_EXCEPTION if the native layer fails).
Attributes: recursive
subroutine code_diff_lines(left, right, added, removed, stat)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
left | character(len=*) | in | The old text. | |
right | character(len=*) | in | The new text. | |
added | integer(kind=int32) | out | allocatable | Lines of right added. |
removed | integer(kind=int32) | out | allocatable | Lines of left removed. |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
joined
words, each trimmed, joined by LF into all; false for an empty word or one with a blank, LF or US inside.
Attributes: pure
subroutine joined(words, all, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
words | character(len=*) | in | Words. | |
all | character(len=:) | out | allocatable | Joined. |
ok | logical | out | All valid. |
Call graph
split_lines
text's LF-separated parts, blank-padded to the longest.
Attributes: pure
subroutine split_lines(text, lines)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text. | |
lines | character(len=:) | out | allocatable | Parts. |
Call graph
Functions
language_name
The language's name ('' for plain text).
Attributes: pure
Returns: character(len=:)
function language_name(self) result(name)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(language_object) | in | Language. |
code_language
A shipped language by name, in any case: 'fortran' (free form, any case, ! comments, both quotes, kinds and exponents in numbers, # preprocessor lines), 'input' (key = value files: [section] lines, keys, ! and # comments, the words true, false, yes, no, on, off), 'text' or '' (plain), and the fork's own: 'angelscript', 'c', 'c++', 'c#', 'glsl', 'hlsl', 'json', 'julia', 'lua', 'markdown', 'python', 'sql', 'wgsl'. Status: FIG_ERR_ARGUMENT for another name (plain text returned). Any thread.
Attributes: recursive
Returns: type(language_object)
function code_language(name, stat) result(lang)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
name | character(len=*) | in | Language name. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_is_initialized
Whether the editor exists.
Attributes: pure
Returns: logical
function editor_is_initialized(self) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. |
editor_text
The text, its lines joined by LF (no LF after the last). '' before init and from a task.
Attributes: recursive
Returns: character(len=:)
function editor_text(self) result(t)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. |
Call graph
editor_line_count
The number of lines (1 for an empty text; 0 before init and from a task).
Attributes: recursive
Returns: integer(kind=int32)
function editor_line_count(self) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. |
Call graph
editor_draw
Draw the editor as a widget at the cursor, inside a window, width x height pixels (0: the available region; negative: up to that distance from its edge), in IBM Plex Mono at the current font size with the fallback font's symbols (they keep their own width: they may overlap the next character), and the style's colours. True on the frame the user changed the text (typing, a paste, undo, a completion: not set_text, insert or replace). The mouse and the keyboard as in a code editor (a click places the cursor, a drag selects, ctrl+click adds a cursor); the wheel scrolls. Statuses: FIG_ERR_ARGUMENT for an empty id; FIG_ERR_STATE before init, with no frame open, from a task. The same in every mode.
Attributes: recursive
Returns: logical
function editor_draw(self, id, width, height, stat) result(changed)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
id | character(len=*) | in | Widget id (unique in the window). | |
width | real(kind=real64) | in | optional | Width [pixels] (default 0: the available width). |
height | real(kind=real64) | in | optional | Height [pixels] (default 0: the available height). |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_mark_of
The severity of the mark on line ('error', 'warning', 'info'; '' for none, a line out of range, before init and from a task), and its message as its tooltip shows it (each message after its severity's word, LF between two).
Attributes: recursive
Returns: character(len=:)
function editor_mark_of(self, line, message) result(severity)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. | |
line | integer(kind=int32) | in | Line, from 1. | |
message | character(len=:) | out | allocatable, optional | Its message. |
Call graph
editor_find
Select the next occurrence of text after the cursor, from the start again past the end, and scroll it into view at the next draw. True when found (the selection is then text). Statuses: FIG_ERR_ARGUMENT for an empty text; FIG_ERR_STATE before init and from a task.
Attributes: recursive
Returns: logical
function editor_find(self, text, case_sensitive, whole_word, stat) result(found)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
text | character(len=*) | in | Text to find. | |
case_sensitive | logical | in | optional | By case (default true). |
whole_word | logical | in | optional | Whole words only (default false). |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_replace
Replace every occurrence of text by by, as one change (one undo), and return how many were replaced. Statuses: FIG_ERR_ARGUMENT for an empty text; FIG_ERR_STATE for a read-only editor, before init and from a task.
Attributes: recursive
Returns: integer(kind=int32)
function editor_replace(self, text, by, case_sensitive, whole_word, stat) result(count)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
text | character(len=*) | in | Text to replace. | |
by | character(len=*) | in | Its replacement. | |
case_sensitive | logical | in | optional | By case (default true). |
whole_word | logical | in | optional | Whole words only (default false). |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_selection
The selection: true when some text is selected, from (first_line, first_column) to just before (last_line, last_column), from 1, columns in characters, and its text; false otherwise (the four positions are then the cursor's). False before init and from a task.
Attributes: recursive
Returns: logical
function editor_selection(self, first_line, first_column, last_line, last_column, text) result(has)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. | |
first_line | integer(kind=int32) | out | First line. | |
first_column | integer(kind=int32) | out | First column [characters]. | |
last_line | integer(kind=int32) | out | Last line. | |
last_column | integer(kind=int32) | out | Column after the last [characters]. | |
text | character(len=:) | out | allocatable, optional | The selected text. |
Call graph
editor_word_at_cursor
The word (letters, digits, _) the cursor is in or just after; '' when none, before init and from a task.
Attributes: recursive
Returns: character(len=:)
function editor_word_at_cursor(self) result(word)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. |
Call graph
editor_completing
True while the completion popup is open (from the frame after the typing that opened it), with the words it offers in its order (blank-padded to the longest). False before init and from a task.
Attributes: recursive
Returns: logical
function editor_completing(self, words) result(open)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. | |
words | character(len=:) | out | allocatable, optional | Words offered. |
Call graph
editor_is_read_only
Whether the editor is read-only (false before init and from a task).
Attributes: recursive
Returns: logical
function editor_is_read_only(self) result(on)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. |
Call graph
editor_undo
Undo the last change (as ctrl+z): true if there was one. Nothing in a read-only editor. Statuses: FIG_ERR_STATE before init and from a task.
Attributes: recursive
Returns: logical
function editor_undo(self, stat) result(done)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_redo
Redo the last undone change (as ctrl+y): true if there was one. Statuses: FIG_ERR_STATE before init and from a task.
Attributes: recursive
Returns: logical
function editor_redo(self, stat) result(done)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | inout | Editor. | |
stat | integer(kind=int32) | out | optional | Status. |
Call graph
editor_line_rect
The rectangle [pixels] of line's text area on the last draw, from the left of the text to the right of the editor (for a popup beside a line, or a test): true when the line was in view. False before the first draw, before init and from a task.
Attributes: recursive
Returns: logical
function editor_line_rect(self, line, x0, y0, x1, y1) result(visible)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. | |
line | integer(kind=int32) | in | Line, from 1. | |
x0 | real(kind=real64) | out | Left [pixels]. | |
y0 | real(kind=real64) | out | Top [pixels]. | |
x1 | real(kind=real64) | out | Right [pixels]. | |
y1 | real(kind=real64) | out | Bottom [pixels]. |
Call graph
alive
True when the editor exists and the caller is on the main thread; else the refusal (FIG_ERR_STATE), silent for a query (quiet: its default value is the answer).
Attributes: recursive
Returns: logical
function alive(self, name, stat, quiet) result(ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. | |
name | character(len=*) | in | The method. | |
stat | integer(kind=int32) | out | optional | Status. |
quiet | logical | in | optional | A query: no failure before init. |
Call graph
editor_string
One of the editor's texts (fig_editor_string): '' before init and from a task.
Attributes: recursive
Returns: character(len=:)
function editor_string(self, what) result(t)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(code_editor_object) | in | Editor. | |
what | integer(kind=c_int) | in | 0 text, 1 word, 2 selection, 3 offered. |
Call graph
pack_language
The language's definition for the native layer (fields separated by US; '' for plain text).
Attributes: pure
Returns: character(len=:)
function pack_language(lang) result(packed)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lang | type(language_object) | in | Language. |
Call graph
lower
s in lower case (ASCII letters).
Attributes: pure
Returns: character(len=len)
function lower(s) result(l)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
s | character(len=*) | in | String. |
Call graph
fortran_keywords
Fortran 2023's statements, constructs and operators (the keywords' colour).
Attributes: pure
Returns: character(len=16)
function fortran_keywords() result(k)Call graph
fortran_types
Fortran's intrinsic types and attributes (the types' colour).
Attributes: pure
Returns: character(len=16)
function fortran_types() result(t)Call graph