1 1.1 christos # Copyright 2023-2024 Free Software Foundation, Inc. 2 1.1 christos 3 1.1 christos # This program is free software; you can redistribute it and/or modify 4 1.1 christos # it under the terms of the GNU General Public License as published by 5 1.1 christos # the Free Software Foundation; either version 3 of the License, or 6 1.1 christos # (at your option) any later version. 7 1.1 christos # 8 1.1 christos # This program is distributed in the hope that it will be useful, 9 1.1 christos # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 1.1 christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 1.1 christos # GNU General Public License for more details. 12 1.1 christos # 13 1.1 christos # You should have received a copy of the GNU General Public License 14 1.1 christos # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 1.1 christos 16 1.1 christos # Check that "set tui compact-source on" has the intended effect. 17 1.1 christos 18 1.1 christos require allow_tui_tests 19 1.1 christos 20 1.1 christos tuiterm_env 21 1.1 christos 22 1.1 christos standard_testfile 23 1.1 christos 24 1.1 christos # Let's generate the source file. We want a short file, with less than 10 25 1.1 christos # lines, and the copyright notice by itself is already more that that. 26 1.1 christos set src_list \ 27 1.1 christos [list \ 28 1.1 christos "int" \ 29 1.1 christos "main (void)" \ 30 1.1 christos "{" \ 31 1.1 christos " return 0;" \ 32 1.1 christos "}"] 33 1.1 christos set re_line_four [string_to_regexp [lindex $src_list 3]] 34 1.1 christos set src_txt [join $src_list "\n"] 35 1.1 christos set srcfile [standard_output_file $srcfile] 36 1.1 christos set fd [open $srcfile w] 37 1.1 christos puts $fd $src_txt 38 1.1 christos close $fd 39 1.1 christos 40 1.1 christos if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { 41 1.1 christos return -1 42 1.1 christos } 43 1.1 christos 44 1.1 christos Term::clean_restart 24 80 $binfile 45 1.1 christos 46 1.1 christos gdb_test_no_output "maint set tui-left-margin-verbose on" 47 1.1 christos gdb_test_no_output "set tui compact-source on" 48 1.1 christos 49 1.1 christos if {![Term::enter_tui]} { 50 1.1 christos unsupported "TUI not supported" 51 1.1 christos return 52 1.1 christos } 53 1.1 christos 54 1.1 christos set re_border "\\|" 55 1.1 christos 56 1.1 christos set max_line_nr_in_source_file [llength $src_list] 57 1.1 christos # Ensure there are more lines in the window than in the source file. 58 1.1 christos set src_window_lines [expr $max_line_nr_in_source_file + 2] 59 1.1 christos # Account for border size. 60 1.1 christos set src_window_size [expr $src_window_lines + 2] 61 1.1 christos Term::command "wh src $src_window_size" 62 1.1 christos 63 1.1 christos set re_left_margin "___4_" 64 1.1 christos 65 1.1 christos Term::check_contents "compact source format" \ 66 1.1 christos "$re_border$re_left_margin$re_line_four *$re_border" 67 1.1 christos 68 1.1 christos set re_left_margin "___0*[expr $max_line_nr_in_source_file + 1]_" 69 1.1 christos Term::check_contents_not "no surplus line number" \ 70 1.1 christos "$re_border$re_left_margin *$re_border" 71