1109 proc add_edit {mb} {
1112 $mb add command -label [msgcat::mc "Undo"] -underline 0 -command [list menus::text_only gui::undo]
1115 $mb add command -label [msgcat::mc "Redo"] -underline 0 -command [list menus::text_only gui::redo]
1120 $mb add command -label [msgcat::mc "Cut"] -underline 0 -command [list menus::text_only gui::cut]
1123 $mb add command -label [msgcat::mc "Copy"] -underline 1 -command [list menus::text_only gui::copy]
1126 $mb add command -label [msgcat::mc "Paste"] -underline 0 -command [list menus::text_only gui::paste]
1129 $mb add command -label [msgcat::mc "Paste and Format"] -underline 10 -command [list menus::text_only gui::paste_and_format]
1134 $mb add cascade -label [msgcat::mc "Select"] -underline 0 -menu [
make_menu $mb.selectPopup -tearoff 0 -postcommand [list menus::edit_select_posting $mb.selectPopup]]
1136 $mb add command -label [msgcat::mc "Select Mode"] -underline 7 -command [list menus::text_only menus::select_mode]
1141 $mb add checkbutton -label [msgcat::mc "Vim Mode"] -underline 0 -variable preferences::prefs(Editor/VimMode) -command [list menus::main_only vim::set_vim_mode_all]
1147 $mb add command -label [msgcat::mc "Toggle Comment"] -underline 0 -command [list menus::text_only edit::comment_toggle]
1150 $mb add cascade -label [msgcat::mc "Indentation"] -underline 0 -menu [
make_menu $mb.indentPopup -tearoff 0 -postcommand [list menus::edit_indent_posting $mb.indentPopup]]
1151 $mb add cascade -label [msgcat::mc "Cursor"] -underline 1 -menu [
make_menu $mb.cursorPopup -tearoff 0 -postcommand [list menus::edit_cursor_posting $mb.cursorPopup]]
1155 $mb add cascade -label [msgcat::mc "Insert"] -menu [
make_menu $mb.insertPopup -tearoff 0 -postcommand [list menus::edit_insert_posting $mb.insertPopup]]
1156 $mb add cascade -label [msgcat::mc "Transform"] -menu [
make_menu $mb.transformPopup -tearoff 0 -postcommand [list menus::edit_transform_posting $mb.transformPopup]]
1157 $mb add cascade -label [msgcat::mc "Format"] -menu [
make_menu $mb.formatPopup -tearoff 0 -postcommand [list menus::edit_format_posting $mb.formatPopup]]
1161 $mb add cascade -label [msgcat::mc "Snippets"] -menu [
make_menu $mb.snipPopup -tearoff 0 -postcommand [list menus::edit_snippets_posting $mb.snipPopup]]
1162 $mb add cascade -label [msgcat::mc "Templates"] -menu [
make_menu $mb.tempPopup -tearoff 0 -postcommand [list menus::edit_templates_posting $mb.tempPopup]]
1163 $mb add cascade -label "Emmet" -menu [
make_menu $mb.emmetPopup -tearoff 0 -postcommand [list menus::edit_emmet_posting $mb.emmetPopup]]
1167 $mb add cascade -label [msgcat::mc "Preferences"] -menu [
make_menu $mb.prefPopup -tearoff 0 -postcommand [list menus::edit_preferences_posting $mb.prefPopup]]
1173 $mb.selectPopup add command -label [msgcat::mc "All"] -underline 0 -command [list menus::text_only select::quick_select all]
1176 $mb.selectPopup add command -label [msgcat::mc "Current Line"] -underline 8 -command [list menus::text_only select::quick_select line]
1179 $mb.selectPopup add command -label [msgcat::mc "Current Word"] -underline 8 -command [list menus::text_only select::quick_select word]
1182 $mb.selectPopup add command -label [msgcat::mc "Current Sentence"] -underline 8 -command [list menus::text_only select::quick_select sentence]
1185 $mb.selectPopup add command -label [msgcat::mc "Current Paragraph"] -underline 8 -command [list menus::text_only select::quick_select paragraph]
1188 $mb.selectPopup add command -label [msgcat::mc "Current Bounded Text"] -underline 8 -command [list menus::text_only select::quick_select bracket]
1189 launcher::register [
make_menu_cmd "Edit" [msgcat::mc "Select current bracketed text, strings or comment block"]] [list menus::text_only select::quick_select bracket]
1191 $mb.selectPopup add separator
1193 $mb.selectPopup add command -label [msgcat::mc "Add Next Line"] -underline 4 -command [list menus::text_only select::quick_add_line next]
1196 $mb.selectPopup add command -label [msgcat::mc "Add Previous Line"] -underline 5 -command [list menus::text_only select::quick_add_line prev]
1203 $mb.indentPopup add command -label [msgcat::mc "Indent"] -underline 0 -command [list menus::text_only menus::indent_command]
1206 $mb.indentPopup add command -label [msgcat::mc "Unindent"] -underline 1 -command [list menus::text_only menus::unindent_command]
1209 $mb.indentPopup add separator
1211 $mb.indentPopup add command -label [msgcat::mc "Format Text"] -command [list menus::text_only gui::format_text]
1214 $mb.indentPopup add separator
1216 $mb.indentPopup add radiobutton -label [msgcat::mc "Indent Off"] -variable menus::indent_mode -value "OFF" -command [list menus::text_only indent::set_current_indent_mode OFF]
1217 launcher::register [
make_menu_cmd "Edit" [
format "%s %s" [msgcat::mc "Set indent mode to"] "OFF"]] [list menus::text_only indent::set_current_indent_mode OFF]
1219 $mb.indentPopup add radiobutton -label [msgcat::mc "Auto-Indent"] -variable menus::indent_mode -value "IND" -command [list menus::text_only indent::set_current_indent_mode IND]
1220 launcher::register [
make_menu_cmd "Edit" [
format "%s %s" [msgcat::mc "Set indent mode to"] "IND"]] [list menus::text_only indent::set_current_indent_mode IND]
1222 $mb.indentPopup add radiobutton -label [msgcat::mc "Smart Indent"] -variable menus::indent_mode -value "IND+" -command [list menus::text_only indent::set_current_indent_mode IND+]
1223 launcher::register [
make_menu_cmd "Edit" [
format "%s %s" [msgcat::mc "Set indent mode to"] "IND+"]] [list menus::text_only indent::set_current_indent_mode IND+]
1229 $mb.cursorPopup add command -label [msgcat::mc "Move to First Line"] -command [list menus::text_only menus::edit_cursor_move first]
1232 $mb.cursorPopup add command -label [msgcat::mc "Move to Last Line"] -command [list menus::text_only menus::edit_cursor_move last]
1235 $mb.cursorPopup add command -label [msgcat::mc "Move to Next Page"] -command [list menus::text_only menus::edit_cursor_move_by_page next]
1238 $mb.cursorPopup add command -label [msgcat::mc "Move to Previous Page"] -command [list menus::text_only menus::edit_cursor_move_by_page prior]
1241 $mb.cursorPopup add separator
1243 $mb.cursorPopup add command -label [msgcat::mc "Move to Screen Top"] -command [list menus::text_only menus::edit_cursor_move screentop]
1246 $mb.cursorPopup add command -label [msgcat::mc "Move to Screen Middle"] -command [list menus::text_only menus::edit_cursor_move screenmid]
1249 $mb.cursorPopup add command -label [msgcat::mc "Move to Screen Bottom"] -command [list menus::text_only menus::edit_cursor_move screenbot]
1252 $mb.cursorPopup add separator
1254 $mb.cursorPopup add command -label [msgcat::mc "Move to Line Start"] -command [list menus::text_only menus::edit_cursor_move linestart]
1255 launcher::register [
make_menu_cmd "Edit" [msgcat::mc "Move cursor to start of current line"]] [list menus::text_only menus::edit_cursor_move linestart]
1257 $mb.cursorPopup add command -label [msgcat::mc "Move to Line End"] -command [list menus::text_only menus::edit_cursor_move lineend]
1260 $mb.cursorPopup add command -label [msgcat::mc "Move to Next Word"] -command [list menus::text_only menus::edit_cursor_move wordstart -dir next]
1263 $mb.cursorPopup add command -label [msgcat::mc "Move to Previous Word"] -command [list menus::text_only menus::edit_cursor_move wordstart -dir prev]
1264 launcher::register [
make_menu_cmd "Edit" [msgcat::mc "Move cursor to previous word"]] [list menus::text_only menus::edit_cursor_move wordstart -dir prev]
1266 $mb.cursorPopup add separator
1268 $mb.cursorPopup add command -label [msgcat::mc "Move Cursors Up"] -command [list menus::text_only menus::edit_cursors_move up]
1271 $mb.cursorPopup add command -label [msgcat::mc "Move Cursors Down"] -command [list menus::text_only menus::edit_cursors_move down]
1274 $mb.cursorPopup add command -label [msgcat::mc "Move Cursors Left"] -command [list menus::text_only menus::edit_cursors_move left]
1277 $mb.cursorPopup add command -label [msgcat::mc "Move Cursors Right"] -command [list menus::text_only menus::edit_cursors_move right]
1280 $mb.cursorPopup add separator
1282 $mb.cursorPopup add command -label [msgcat::mc "Align Cursors Only"] -command [list menus::text_only edit::align_cursors]
1285 $mb.cursorPopup add command -label [msgcat::mc "Align Cursors and Text"] -command [list menus::text_only edit::align_cursors_and_text]
1292 $mb.insertPopup add command -label [msgcat::mc "Line Above Current"] -command [list menus::text_only menus::edit_insert_line_above]
1295 $mb.insertPopup add command -label [msgcat::mc "Line Below Current"] -command [list menus::text_only menus::edit_insert_line_below]
1298 $mb.insertPopup add separator
1300 $mb.insertPopup add command -label [msgcat::mc "File Contents"] -command [list menus::text_only menus::edit_insert_file_after_current_line]
1301 launcher::register [
make_menu_cmd "Edit" [msgcat::mc "Insert file contents after current line"]] [list menus::text_only menus::edit_insert_file_after_current_line]
1303 $mb.insertPopup add command -label [msgcat::mc "Command Result"] -command [list menus::text_only menus::edit_insert_command_after_current_line]
1304 launcher::register [
make_menu_cmd "Edit" [msgcat::mc "Insert command result after current line"]] [list menus::text_only menus::edit_insert_command_after_current_line]
1306 $mb.insertPopup add separator
1308 $mb.insertPopup add command -label [msgcat::mc "From Clipboard"] -command [list menus::text_only cliphist::show_cliphist]
1311 $mb.insertPopup add command -label [msgcat::mc "Snippet"] -command [list menus::text_only snippets::show_snippets]
1314 $mb.insertPopup add separator
1316 $mb.insertPopup add command -label [msgcat::mc "Enumeration"] -underline 7 -command [list menus::text_only edit::insert_enumeration]
1323 $mb.transformPopup add command -label [msgcat::mc "Toggle Case"] -command [list menus::text_only menus::edit_transform_toggle_case]
1326 $mb.transformPopup add command -label [msgcat::mc "Lower Case"] -command [list menus::text_only menus::edit_transform_to_lower_case]
1329 $mb.transformPopup add command -label [msgcat::mc "Upper Case"] -command [list menus::text_only menus::edit_transform_to_upper_case]
1332 $mb.transformPopup add command -label [msgcat::mc "Title Case"] -command [list menus::text_only menus::edit_transform_to_title_case]
1335 $mb.transformPopup add separator
1337 $mb.transformPopup add command -label [msgcat::mc "Join Lines"] -command [list menus::text_only menus::edit_transform_join_lines]
1340 $mb.transformPopup add separator
1342 $mb.transformPopup add command -label [msgcat::mc "Bubble Up"] -command [list menus::text_only menus::edit_transform_bubble_up]
1345 $mb.transformPopup add command -label [msgcat::mc "Bubble Down"] -command [list menus::text_only menus::edit_transform_bubble_down]
1348 $mb.transformPopup add separator
1350 $mb.transformPopup add command -label [msgcat::mc "Replace Line With Script"] -command [list menus::text_only edit::replace_line_with_script]
1357 set fmtstr [msgcat::mc "formatting"]
1359 $mb.formatPopup add command -label [msgcat::mc "Bold"] -command [list menus::text_only menus::edit_format bold]
1362 $mb.formatPopup add command -label [msgcat::mc "Italics"] -command [list menus::text_only menus::edit_format italics]
1365 $mb.formatPopup add command -label [msgcat::mc "Underline"] -command [list menus::text_only menus::edit_format underline]
1368 $mb.formatPopup add command -label [msgcat::mc "Strikethrough"] -command [list menus::text_only menus::edit_format strikethrough]
1371 $mb.formatPopup add command -label [msgcat::mc "Highlight"] -command [list menus::text_only menus::edit_format highlight]
1374 $mb.formatPopup add command -label [msgcat::mc "Superscript"] -command [list menus::text_only menus::edit_format superscript]
1377 $mb.formatPopup add command -label [msgcat::mc "Subscript"] -command [list menus::text_only menus::edit_format subscript]
1380 $mb.formatPopup add command -label [msgcat::mc "Code"] -command [list menus::text_only menus::edit_format code]
1383 $mb.formatPopup add separator
1385 $mb.formatPopup add command -label [
format "%s 1" [msgcat::mc "Header"]] -command [list menus::text_only menus::edit_format header1]
1386 launcher::register [
make_menu_cmd "Edit" [
format "%s 1 %s" [msgcat::mc "Insert header style"] $fmtstr]] [list menus::text_only menus::edit_format header1]
1388 $mb.formatPopup add command -label [
format "%s 2" [msgcat::mc "Header"]] -command [list menus::text_only menus::edit_format header2]
1389 launcher::register [
make_menu_cmd "Edit" [
format "%s 2 %s" [msgcat::mc "Insert header style"] $fmtstr]] [list menus::text_only menus::edit_format header2]
1391 $mb.formatPopup add command -label [
format "%s 3" [msgcat::mc "Header"]] -command [list menus::text_only menus::edit_format header3]
1392 launcher::register [
make_menu_cmd "Edit" [
format "%s 3 %s" [msgcat::mc "Insert header style"] $fmtstr]] [list menus::text_only menus::edit_format header3]
1394 $mb.formatPopup add command -label [
format "%s 4" [msgcat::mc "Header"]] -command [list menus::text_only menus::edit_format header4]
1395 launcher::register [
make_menu_cmd "Edit" [
format "%s 4 %s" [msgcat::mc "Insert header style"] $fmtstr]] [list menus::text_only menus::edit_format header4]
1397 $mb.formatPopup add command -label [
format "%s 5" [msgcat::mc "Header"]] -command [list menus::text_only menus::edit_format header5]
1398 launcher::register [
make_menu_cmd "Edit" [
format "%s 5 %s" [msgcat::mc "Insert header style"] $fmtstr]] [list menus::text_only menus::edit_format header5]
1400 $mb.formatPopup add command -label [
format "%s 6" [msgcat::mc "Header"]] -command [list menus::text_only menus::edit_format header6]
1401 launcher::register [
make_menu_cmd "Edit" [
format "%s 6 %s" [msgcat::mc "Insert header style"] $fmtstr]] [list menus::text_only menus::edit_format header6]
1403 $mb.formatPopup add separator
1405 $mb.formatPopup add command -label [msgcat::mc "Unordered Bullet"] -command [list menus::text_only menus::edit_format unordered]
1408 $mb.formatPopup add command -label [msgcat::mc "Ordered Bullet"] -command [list menus::text_only menus::edit_format ordered]
1411 $mb.formatPopup add command -label [msgcat::mc "Checkbox"] -command [list menus::text_only menus::edit_format checkbox]
1414 $mb.formatPopup add separator
1416 $mb.formatPopup add command -label [msgcat::mc "Link"] -command [list menus::text_only menus::edit_format link]
1419 $mb.formatPopup add command -label [msgcat::mc "Image"] -command [list menus::text_only menus::edit_format image]
1422 $mb.formatPopup add separator
1424 $mb.formatPopup add command -label [msgcat::mc "Remove Formatting"] -command [list menus::text_only menus::edit_format_remove]
1431 $mb.prefPopup add command -label [
format "%s - %s" [msgcat::mc "Edit User"] [msgcat::mc "Global"]] -command [list menus::edit_user_global]
1434 $mb.prefPopup add command -label [
format "%s - %s" [msgcat::mc "Edit User"] [msgcat::mc "Language"]] -command [list menus::edit_user_language]
1437 $mb.prefPopup add separator
1439 $mb.prefPopup add command -label [
format "%s - %s" [msgcat::mc "Delete User"] [msgcat::mc "Language"]] -command [list menus::delete_user_language]
1441 $mb.prefPopup add separator
1443 $mb.prefPopup add command -label [
format "%s - %s" [msgcat::mc "Edit Session"] [msgcat::mc "Global"]] -command [list menus::edit_session_global]
1446 $mb.prefPopup add command -label [
format "%s - %s" [msgcat::mc "Edit Session"] [msgcat::mc "Language"]] -command [list menus::edit_session_language]
1449 $mb.prefPopup add separator
1451 $mb.prefPopup add command -label [
format "%s - %s" [msgcat::mc "Delete Session"] [msgcat::mc "Language"]] -command [list menus::delete_session_language]
1457 $mb.snipPopup add command -label [msgcat::mc "Edit User"] -command [list menus::main_only menus::add_new_snippet user]
1460 $mb.snipPopup add command -label [msgcat::mc "Edit Language"] -command [list menus::main_only menus::add_new_snippet lang]
1463 $mb.snipPopup add separator
1465 $mb.snipPopup add command -label [msgcat::mc "Reload"] -command [list menus::main_only snippets::reload_snippets]
1472 $mb.tempPopup add command -label [msgcat::mc "Edit"] -command [list menus::main_only templates::show_templates edit]
1475 $mb.tempPopup add command -label [msgcat::mc "Delete"] -command [list menus::main_only templates::show_templates delete]
1478 $mb.tempPopup add separator
1480 $mb.tempPopup add command -label [msgcat::mc "Reload"] -command [list menus::main_only templates::preload]
1487 $mb.emmetPopup add command -label [msgcat::mc "Expand Abbreviation"] -command [list menus::text_only emmet::expand_abbreviation]
1490 $mb.emmetPopup add command -label [msgcat::mc "Wrap With Abbreviation"] -command [list menus::text_only emmet::wrap_with_abbreviation]
1493 $mb.emmetPopup add separator
1495 $mb.emmetPopup add command -label [msgcat::mc "Balance Outward"] -command [list menus::text_only emmet::balance_outward]
1498 $mb.emmetPopup add command -label [msgcat::mc "Balance Inward"] -command [list menus::text_only emmet::balance_inward]
1501 $mb.emmetPopup add command -label [msgcat::mc "Go to Matching Pair"] -command [list menus::text_only emmet::go_to_matching_pair]
1504 $mb.emmetPopup add separator
1506 $mb.emmetPopup add command -label [msgcat::mc "Toggle Comment"] -command [list menus::text_only emmet::toggle_comment]
1509 $mb.emmetPopup add command -label [msgcat::mc "Split/Join Tag"] -command [list menus::text_only emmet::split_join_tag]
1512 $mb.emmetPopup add command -label [msgcat::mc "Remove Tag"] -command [list menus::text_only emmet::remove_tag]
1515 $mb.emmetPopup add command -label [msgcat::mc "Merge Lines"] -command [list menus::text_only emmet::merge_lines]
1518 $mb.emmetPopup add command -label [msgcat::mc "Update Image Size"] -command [list menus::text_only emmet::update_image_size]
1521 $mb.emmetPopup add command -label [msgcat::mc "Encode/Decode Image to Data:URL"] -command [list menus::text_only emmet::encode_decode_image_to_data_url]
1522 launcher::register [
make_menu_cmd "Edit" [msgcat::mc "Encode/Decode image to data:URL"]] [list menus::text_only emmet::encode_decode_image_to_data_url]
1524 $mb.emmetPopup add command -label [msgcat::mc "Reflect CSS Value"] -command [list menus::text_only emmet_css::reflect_css_value]
1527 $mb.emmetPopup add separator
1529 $mb.emmetPopup add command -label [msgcat::mc "Next Edit Point"] -command [list menus::text_only emmet::go_to_edit_point next]
1532 $mb.emmetPopup add command -label [msgcat::mc "Previous Edit Point"] -command [list menus::text_only emmet::go_to_edit_point prev]
1535 $mb.emmetPopup add separator
1537 $mb.emmetPopup add command -label [msgcat::mc "Select Next Item"] -command [list menus::text_only emmet::select_item next]
1540 $mb.emmetPopup add command -label [msgcat::mc "Select Previous Item"] -command [list menus::text_only emmet::select_item prev]
1543 $mb.emmetPopup add separator
1545 $mb.emmetPopup add command -label [msgcat::mc "Evaluate Math Expression"] -command [list menus::text_only emmet::evaluate_math_expression]
1548 $mb.emmetPopup add separator
1550 $mb.emmetPopup add command -label [msgcat::mc "Increment by 10"] -command [list menus::text_only emmet::change_number 10]
1553 $mb.emmetPopup add command -label [msgcat::mc "Increment by 1"] -command [list menus::text_only emmet::change_number 1]
1556 $mb.emmetPopup add command -label [msgcat::mc "Increment by 0.1"] -command [list menus::text_only emmet::change_number 0.1]
1559 $mb.emmetPopup add command -label [msgcat::mc "Decrement by 10"] -command [list menus::text_only emmet::change_number -10]
1562 $mb.emmetPopup add command -label [msgcat::mc "Decrement by 1"] -command [list menus::text_only emmet::change_number -1]
1565 $mb.emmetPopup add command -label [msgcat::mc "Decrement by 0.1"] -command [list menus::text_only emmet::change_number -0.1]
1568 $mb.emmetPopup add separator
1570 $mb.emmetPopup add command -label [msgcat::mc "Edit Custom Abbreviations"] -command [list menus::main_only emmet::edit_abbreviations]
1573 $mb.emmetPopup add separator
1575 $mb.emmetPopup add command -label [msgcat::mc "View Emmet Reference Guide"] -command [list menus::main_only emmet::view_reference]