diff options
31 files changed, 15514 insertions, 4 deletions
diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc index dfaa4edf..38896403 100644 --- a/core/.buffer.luadoc +++ b/core/.buffer.luadoc @@ -157,6 +157,12 @@ -- The caret line's background alpha value, ranging from `0` (transparent) to -- `255` (opaque). -- The default value is `buffer.ALPHA_NOALPHA`, for no alpha. +-- @field caret_line_frame (number) +-- The caret line's frame width in pixels. +-- When non-zero, the line that contains the caret is framed instead of +-- colored in. The `buffer.caret_line_back` and `buffer.caret_line_back_alpha` +-- properties apply to the frame. +-- The default value is `0`. -- @field caret_line_visible (bool) -- Color the background of the line that contains the caret a different color. -- The default value is `false`. @@ -750,8 +756,7 @@ -- Table of flags that indicate whether or not text 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 that contain read-only text are deletable. +-- Read-only styles do not allow the caret into the range of text. -- @field style_eol_filled (table) -- Table of flags that indicate whether or not the background colors of styles -- whose characters occur last on lines extend all the way to the view's right @@ -2071,6 +2076,11 @@ function line_from_position(buffer, pos) end function line_length(buffer, line) end --- +-- Reverses the order of the selected lines. +-- @param buffer A buffer. +function line_reverse(buffer) end + +--- -- Scrolls the buffer right *columns* columns and down *lines* lines. -- Negative values are allowed. -- @param buffer A buffer. diff --git a/core/iface.lua b/core/iface.lua index 46c470f7..af059b79 100644 --- a/core/iface.lua +++ b/core/iface.lua @@ -31,7 +31,7 @@ M.constants = {ACCESSIBILITY_DISABLED=0,ACCESSIBILITY_ENABLED=1,ALPHA_NOALPHA=25 -- + `8`: String return value. -- @class table -- @name functions -M.functions = {add_ref_document={2376,0,0,1},add_selection={2573,0,3,3},add_styled_text={2002,0,2,9},add_tab_stop={2676,0,1,1},add_text={2001,0,2,7},add_undo_action={2560,0,1,1},allocate={2446,0,1,0},allocate_extended_styles={2553,1,1,0},allocate_sub_styles={4020,1,1,1},annotation_clear_all={2547,0,0,0},append_text={2282,0,2,7},assign_cmd_key={2070,0,6,1},auto_c_active={2102,5,0,0},auto_c_cancel={2101,0,0,0},auto_c_complete={2104,0,0,0},auto_c_pos_start={2103,3,0,0},auto_c_select={2108,0,0,7},auto_c_show={2100,0,1,7},auto_c_stops={2105,0,0,7},back_tab={2328,0,0,0},begin_undo_action={2078,0,0,0},brace_bad_light={2352,0,3,0},brace_bad_light_indicator={2499,0,5,1},brace_highlight={2351,0,3,3},brace_highlight_indicator={2498,0,5,1},brace_match={2353,3,3,1},call_tip_active={2202,5,0,0},call_tip_cancel={2201,0,0,0},call_tip_pos_start={2203,3,0,0},call_tip_set_hlt={2204,0,1,1},call_tip_show={2200,0,3,7},can_paste={2173,5,0,0},can_redo={2016,5,0,0},can_undo={2174,5,0,0},cancel={2325,0,0,0},change_insertion={2672,0,2,7},change_lexer_state={2617,1,3,3},char_left={2304,0,0,0},char_left_extend={2305,0,0,0},char_left_rect_extend={2428,0,0,0},char_position_from_point={2561,3,1,1},char_position_from_point_close={2562,3,1,1},char_right={2306,0,0,0},char_right_extend={2307,0,0,0},char_right_rect_extend={2429,0,0,0},choose_caret_x={2399,0,0,0},clear={2180,0,0,0},clear_all={2004,0,0,0},clear_all_cmd_keys={2072,0,0,0},clear_cmd_key={2071,0,6,0},clear_document_style={2005,0,0,0},clear_registered_images={2408,0,0,0},clear_representation={2667,0,7,0},clear_selections={2571,0,0,0},clear_tab_stops={2675,0,1,0},colourise={4003,0,3,3},contracted_fold_next={2618,1,1,0},convert_eols={2029,0,1,0},copy={2178,0,0,0},copy_allow_line={2519,0,0,0},copy_range={2419,0,3,3},copy_text={2420,0,2,7},count_characters={2633,1,3,3},create_document={2375,1,0,0},create_loader={2632,1,1,0},cut={2177,0,0,0},del_line_left={2395,0,0,0},del_line_right={2396,0,0,0},del_word_left={2335,0,0,0},del_word_right={2336,0,0,0},del_word_right_end={2518,0,0,0},delete_back={2326,0,0,0},delete_back_not_line={2344,0,0,0},delete_range={2645,0,3,1},describe_key_word_sets={4017,1,0,8},describe_property={4016,1,7,8},doc_line_from_visible={2221,1,1,0},document_end={2318,0,0,0},document_end_extend={2319,0,0,0},document_start={2316,0,0,0},document_start_extend={2317,0,0,0},drop_selection_n={2671,0,1,0},edit_toggle_overtype={2324,0,0,0},empty_undo_buffer={2175,0,0,0},encoded_from_utf8={2449,1,7,8},end_undo_action={2079,0,0,0},ensure_visible={2232,0,1,0},ensure_visible_enforce_policy={2234,0,1,0},expand_children={2239,0,1,1},find_column={2456,1,1,1},find_indicator_flash={2641,0,3,3},find_indicator_hide={2642,0,0,0},find_indicator_show={2640,0,3,3},find_text={2150,3,1,11},fold_all={2662,0,1,0},fold_children={2238,0,1,1},fold_line={2237,0,1,1},form_feed={2330,0,0,0},format_range={2151,3,5,12},free_sub_styles={4023,0,0,0},get_cur_line={2027,1,2,8},get_hotspot_active_back={2495,4,0,0},get_hotspot_active_fore={2494,4,0,0},get_last_child={2224,1,1,1},get_line={2153,1,1,8},get_line_sel_end_position={2425,3,1,0},get_line_sel_start_position={2424,3,1,0},get_next_tab_stop={2677,1,1,1},get_sel_text={2161,1,0,8},get_styled_text={2015,1,0,10},get_text={2182,1,2,8},get_text_range={2162,1,0,10},goto_line={2024,0,1,0},goto_pos={2025,0,3,0},grab_focus={2400,0,0,0},hide_lines={2227,0,1,1},hide_selection={2163,0,5,0},home={2312,0,0,0},home_display={2345,0,0,0},home_display_extend={2346,0,0,0},home_extend={2313,0,0,0},home_rect_extend={2430,0,0,0},home_wrap={2349,0,0,0},home_wrap_extend={2450,0,0,0},indicator_all_on_for={2506,1,3,0},indicator_clear_range={2505,0,3,1},indicator_end={2509,1,1,3},indicator_fill_range={2504,0,3,1},indicator_start={2508,1,1,3},indicator_value_at={2507,1,1,3},insert_text={2003,0,3,7},is_range_word={2691,5,3,3},line_copy={2455,0,0,0},line_cut={2337,0,0,0},line_delete={2338,0,0,0},line_down={2300,0,0,0},line_down_extend={2301,0,0,0},line_down_rect_extend={2426,0,0,0},line_duplicate={2404,0,0,0},line_end={2314,0,0,0},line_end_display={2347,0,0,0},line_end_display_extend={2348,0,0,0},line_end_extend={2315,0,0,0},line_end_rect_extend={2432,0,0,0},line_end_wrap={2451,0,0,0},line_end_wrap_extend={2452,0,0,0},line_from_position={2166,1,3,0},line_length={2350,1,1,0},line_scroll={2168,0,1,1},line_scroll_down={2342,0,0,0},line_scroll_up={2343,0,0,0},line_transpose={2339,0,0,0},line_up={2302,0,0,0},line_up_extend={2303,0,0,0},line_up_rect_extend={2427,0,0,0},lines_join={2288,0,0,0},lines_split={2289,0,1,0},load_lexer_library={4007,0,0,7},lower_case={2340,0,0,0},margin_text_clear_all={2536,0,0,0},marker_add={2043,1,1,1},marker_add_set={2466,0,1,1},marker_define={2040,0,1,1},marker_define_pixmap={2049,0,1,7},marker_define_rgba_image={2626,0,1,7},marker_delete={2044,0,1,1},marker_delete_all={2045,0,1,0},marker_delete_handle={2018,0,1,0},marker_enable_highlight={2293,0,5,0},marker_get={2046,1,1,0},marker_line_from_handle={2017,1,1,0},marker_next={2047,1,1,1},marker_previous={2048,1,1,1},marker_symbol_defined={2529,1,1,0},move_caret_inside_view={2401,0,0,0},move_selected_lines_down={2621,0,0,0},move_selected_lines_up={2620,0,0,0},multi_edge_add_line={2694,0,1,4},multi_edge_clear_all={2695,0,0,0},multiple_select_add_each={2689,0,0,0},multiple_select_add_next={2688,0,0,0},new_line={2329,0,0,0},null={2172,0,0,0},page_down={2322,0,0,0},page_down_extend={2323,0,0,0},page_down_rect_extend={2434,0,0,0},page_up={2320,0,0,0},page_up_extend={2321,0,0,0},page_up_rect_extend={2433,0,0,0},para_down={2413,0,0,0},para_down_extend={2414,0,0,0},para_up={2415,0,0,0},para_up_extend={2416,0,0,0},paste={2179,0,0,0},point_x_from_position={2164,1,0,3},point_y_from_position={2165,1,0,3},position_after={2418,3,3,0},position_before={2417,3,3,0},position_from_line={2167,3,1,0},position_from_point={2022,3,1,1},position_from_point_close={2023,3,1,1},position_relative={2670,3,3,1},private_lexer_call={4013,1,1,1},property_names={4014,1,0,8},property_type={4015,1,7,0},redo={2011,0,0,0},register_image={2405,0,1,7},register_rgba_image={2627,0,1,7},release_all_extended_styles={2552,0,0,0},release_document={2377,0,0,1},replace_sel={2170,0,0,7},replace_target={2194,1,2,7},replace_target_re={2195,1,2,7},rotate_selection={2606,0,0,0},scroll_caret={2169,0,0,0},scroll_range={2569,0,3,3},scroll_to_end={2629,0,0,0},scroll_to_start={2628,0,0,0},search_anchor={2366,0,0,0},search_in_target={2197,1,2,7},search_next={2367,1,1,7},search_prev={2368,1,1,7},select_all={2013,0,0,0},selection_duplicate={2469,0,0,0},set_chars_default={2444,0,0,0},set_empty_selection={2556,0,3,0},set_fold_margin_colour={2290,0,5,4},set_fold_margin_hi_colour={2291,0,5,4},set_hotspot_active_back={2411,0,5,4},set_hotspot_active_fore={2410,0,5,4},set_length_for_encode={2448,0,1,0},set_save_point={2014,0,0,0},set_sel={2160,0,3,3},set_sel_back={2068,0,5,4},set_sel_fore={2067,0,5,4},set_selection={2572,0,3,3},set_styling={2033,0,2,1},set_styling_ex={2073,0,2,7},set_target_range={2686,0,3,3},set_text={2181,0,0,7},set_visible_policy={2394,0,1,1},set_whitespace_back={2085,0,5,4},set_whitespace_fore={2084,0,5,4},set_x_caret_policy={2402,0,1,1},set_y_caret_policy={2403,0,1,1},show_lines={2226,0,1,1},start_record={3001,0,0,0},start_styling={2032,0,3,1},stop_record={3002,0,0,0},stuttered_page_down={2437,0,0,0},stuttered_page_down_extend={2438,0,0,0},stuttered_page_up={2435,0,0,0},stuttered_page_up_extend={2436,0,0,0},style_clear_all={2050,0,0,0},style_reset_default={2058,0,0,0},swap_main_anchor_caret={2607,0,0,0},tab={2327,0,0,0},target_as_utf8={2447,1,0,8},target_from_selection={2287,0,0,0},target_whole_document={2690,0,0,0},text_height={2279,1,1,0},text_width={2276,1,1,7},toggle_caret_sticky={2459,0,0,0},toggle_fold={2231,0,1,0},toggle_fold_show_text={2700,0,1,7},undo={2176,0,0,0},upper_case={2341,0,0,0},use_pop_up={2371,0,1,0},user_list_show={2117,0,1,7},vc_home={2331,0,0,0},vc_home_display={2652,0,0,0},vc_home_display_extend={2653,0,0,0},vc_home_extend={2332,0,0,0},vc_home_rect_extend={2431,0,0,0},vc_home_wrap={2453,0,0,0},vc_home_wrap_extend={2454,0,0,0},vertical_centre_caret={2619,0,0,0},visible_from_doc_line={2220,1,1,0},word_end_position={2267,1,3,5},word_left={2308,0,0,0},word_left_end={2439,0,0,0},word_left_end_extend={2440,0,0,0},word_left_extend={2309,0,0,0},word_part_left={2390,0,0,0},word_part_left_extend={2391,0,0,0},word_part_right={2392,0,0,0},word_part_right_extend={2393,0,0,0},word_right={2310,0,0,0},word_right_end={2441,0,0,0},word_right_end_extend={2442,0,0,0},word_right_extend={2311,0,0,0},word_start_position={2266,1,3,5},wrap_count={2235,1,1,0},zoom_in={2333,0,0,0},zoom_out={2334,0,0,0},} +M.functions = {add_ref_document={2376,0,0,1},add_selection={2573,0,3,3},add_styled_text={2002,0,2,9},add_tab_stop={2676,0,1,1},add_text={2001,0,2,7},add_undo_action={2560,0,1,1},allocate={2446,0,1,0},allocate_extended_styles={2553,1,1,0},allocate_sub_styles={4020,1,1,1},annotation_clear_all={2547,0,0,0},append_text={2282,0,2,7},assign_cmd_key={2070,0,6,1},auto_c_active={2102,5,0,0},auto_c_cancel={2101,0,0,0},auto_c_complete={2104,0,0,0},auto_c_pos_start={2103,3,0,0},auto_c_select={2108,0,0,7},auto_c_show={2100,0,1,7},auto_c_stops={2105,0,0,7},back_tab={2328,0,0,0},begin_undo_action={2078,0,0,0},brace_bad_light={2352,0,3,0},brace_bad_light_indicator={2499,0,5,1},brace_highlight={2351,0,3,3},brace_highlight_indicator={2498,0,5,1},brace_match={2353,3,3,1},call_tip_active={2202,5,0,0},call_tip_cancel={2201,0,0,0},call_tip_pos_start={2203,3,0,0},call_tip_set_hlt={2204,0,1,1},call_tip_show={2200,0,3,7},can_paste={2173,5,0,0},can_redo={2016,5,0,0},can_undo={2174,5,0,0},cancel={2325,0,0,0},change_insertion={2672,0,2,7},change_lexer_state={2617,1,3,3},char_left={2304,0,0,0},char_left_extend={2305,0,0,0},char_left_rect_extend={2428,0,0,0},char_position_from_point={2561,3,1,1},char_position_from_point_close={2562,3,1,1},char_right={2306,0,0,0},char_right_extend={2307,0,0,0},char_right_rect_extend={2429,0,0,0},choose_caret_x={2399,0,0,0},clear={2180,0,0,0},clear_all={2004,0,0,0},clear_all_cmd_keys={2072,0,0,0},clear_cmd_key={2071,0,6,0},clear_document_style={2005,0,0,0},clear_registered_images={2408,0,0,0},clear_representation={2667,0,7,0},clear_selections={2571,0,0,0},clear_tab_stops={2675,0,1,0},colourise={4003,0,3,3},contracted_fold_next={2618,1,1,0},convert_eols={2029,0,1,0},copy={2178,0,0,0},copy_allow_line={2519,0,0,0},copy_range={2419,0,3,3},copy_text={2420,0,2,7},count_characters={2633,1,3,3},create_document={2375,1,0,0},create_loader={2632,1,1,0},cut={2177,0,0,0},del_line_left={2395,0,0,0},del_line_right={2396,0,0,0},del_word_left={2335,0,0,0},del_word_right={2336,0,0,0},del_word_right_end={2518,0,0,0},delete_back={2326,0,0,0},delete_back_not_line={2344,0,0,0},delete_range={2645,0,3,1},describe_key_word_sets={4017,1,0,8},describe_property={4016,1,7,8},doc_line_from_visible={2221,1,1,0},document_end={2318,0,0,0},document_end_extend={2319,0,0,0},document_start={2316,0,0,0},document_start_extend={2317,0,0,0},drop_selection_n={2671,0,1,0},edit_toggle_overtype={2324,0,0,0},empty_undo_buffer={2175,0,0,0},encoded_from_utf8={2449,1,7,8},end_undo_action={2079,0,0,0},ensure_visible={2232,0,1,0},ensure_visible_enforce_policy={2234,0,1,0},expand_children={2239,0,1,1},find_column={2456,1,1,1},find_indicator_flash={2641,0,3,3},find_indicator_hide={2642,0,0,0},find_indicator_show={2640,0,3,3},find_text={2150,3,1,11},fold_all={2662,0,1,0},fold_children={2238,0,1,1},fold_line={2237,0,1,1},form_feed={2330,0,0,0},format_range={2151,3,5,12},free_sub_styles={4023,0,0,0},get_cur_line={2027,1,2,8},get_hotspot_active_back={2495,4,0,0},get_hotspot_active_fore={2494,4,0,0},get_last_child={2224,1,1,1},get_line={2153,1,1,8},get_line_sel_end_position={2425,3,1,0},get_line_sel_start_position={2424,3,1,0},get_next_tab_stop={2677,1,1,1},get_sel_text={2161,1,0,8},get_styled_text={2015,1,0,10},get_text={2182,1,2,8},get_text_range={2162,1,0,10},goto_line={2024,0,1,0},goto_pos={2025,0,3,0},grab_focus={2400,0,0,0},hide_lines={2227,0,1,1},hide_selection={2163,0,5,0},home={2312,0,0,0},home_display={2345,0,0,0},home_display_extend={2346,0,0,0},home_extend={2313,0,0,0},home_rect_extend={2430,0,0,0},home_wrap={2349,0,0,0},home_wrap_extend={2450,0,0,0},indicator_all_on_for={2506,1,3,0},indicator_clear_range={2505,0,3,1},indicator_end={2509,1,1,3},indicator_fill_range={2504,0,3,1},indicator_start={2508,1,1,3},indicator_value_at={2507,1,1,3},insert_text={2003,0,3,7},is_range_word={2691,5,3,3},line_copy={2455,0,0,0},line_cut={2337,0,0,0},line_delete={2338,0,0,0},line_down={2300,0,0,0},line_down_extend={2301,0,0,0},line_down_rect_extend={2426,0,0,0},line_duplicate={2404,0,0,0},line_end={2314,0,0,0},line_end_display={2347,0,0,0},line_end_display_extend={2348,0,0,0},line_end_extend={2315,0,0,0},line_end_rect_extend={2432,0,0,0},line_end_wrap={2451,0,0,0},line_end_wrap_extend={2452,0,0,0},line_from_position={2166,1,3,0},line_length={2350,1,1,0},line_reverse={2354,0,0,0},line_scroll={2168,0,1,1},line_scroll_down={2342,0,0,0},line_scroll_up={2343,0,0,0},line_transpose={2339,0,0,0},line_up={2302,0,0,0},line_up_extend={2303,0,0,0},line_up_rect_extend={2427,0,0,0},lines_join={2288,0,0,0},lines_split={2289,0,1,0},load_lexer_library={4007,0,0,7},lower_case={2340,0,0,0},margin_text_clear_all={2536,0,0,0},marker_add={2043,1,1,1},marker_add_set={2466,0,1,1},marker_define={2040,0,1,1},marker_define_pixmap={2049,0,1,7},marker_define_rgba_image={2626,0,1,7},marker_delete={2044,0,1,1},marker_delete_all={2045,0,1,0},marker_delete_handle={2018,0,1,0},marker_enable_highlight={2293,0,5,0},marker_get={2046,1,1,0},marker_line_from_handle={2017,1,1,0},marker_next={2047,1,1,1},marker_previous={2048,1,1,1},marker_symbol_defined={2529,1,1,0},move_caret_inside_view={2401,0,0,0},move_selected_lines_down={2621,0,0,0},move_selected_lines_up={2620,0,0,0},multi_edge_add_line={2694,0,1,4},multi_edge_clear_all={2695,0,0,0},multiple_select_add_each={2689,0,0,0},multiple_select_add_next={2688,0,0,0},new_line={2329,0,0,0},null={2172,0,0,0},page_down={2322,0,0,0},page_down_extend={2323,0,0,0},page_down_rect_extend={2434,0,0,0},page_up={2320,0,0,0},page_up_extend={2321,0,0,0},page_up_rect_extend={2433,0,0,0},para_down={2413,0,0,0},para_down_extend={2414,0,0,0},para_up={2415,0,0,0},para_up_extend={2416,0,0,0},paste={2179,0,0,0},point_x_from_position={2164,1,0,3},point_y_from_position={2165,1,0,3},position_after={2418,3,3,0},position_before={2417,3,3,0},position_from_line={2167,3,1,0},position_from_point={2022,3,1,1},position_from_point_close={2023,3,1,1},position_relative={2670,3,3,1},private_lexer_call={4013,1,1,1},property_names={4014,1,0,8},property_type={4015,1,7,0},redo={2011,0,0,0},register_image={2405,0,1,7},register_rgba_image={2627,0,1,7},release_all_extended_styles={2552,0,0,0},release_document={2377,0,0,1},replace_sel={2170,0,0,7},replace_target={2194,1,2,7},replace_target_re={2195,1,2,7},rotate_selection={2606,0,0,0},scroll_caret={2169,0,0,0},scroll_range={2569,0,3,3},scroll_to_end={2629,0,0,0},scroll_to_start={2628,0,0,0},search_anchor={2366,0,0,0},search_in_target={2197,1,2,7},search_next={2367,1,1,7},search_prev={2368,1,1,7},select_all={2013,0,0,0},selection_duplicate={2469,0,0,0},set_chars_default={2444,0,0,0},set_empty_selection={2556,0,3,0},set_fold_margin_colour={2290,0,5,4},set_fold_margin_hi_colour={2291,0,5,4},set_hotspot_active_back={2411,0,5,4},set_hotspot_active_fore={2410,0,5,4},set_length_for_encode={2448,0,1,0},set_save_point={2014,0,0,0},set_sel={2160,0,3,3},set_sel_back={2068,0,5,4},set_sel_fore={2067,0,5,4},set_selection={2572,0,3,3},set_styling={2033,0,2,1},set_styling_ex={2073,0,2,7},set_target_range={2686,0,3,3},set_text={2181,0,0,7},set_visible_policy={2394,0,1,1},set_whitespace_back={2085,0,5,4},set_whitespace_fore={2084,0,5,4},set_x_caret_policy={2402,0,1,1},set_y_caret_policy={2403,0,1,1},show_lines={2226,0,1,1},start_record={3001,0,0,0},start_styling={2032,0,3,1},stop_record={3002,0,0,0},stuttered_page_down={2437,0,0,0},stuttered_page_down_extend={2438,0,0,0},stuttered_page_up={2435,0,0,0},stuttered_page_up_extend={2436,0,0,0},style_clear_all={2050,0,0,0},style_reset_default={2058,0,0,0},swap_main_anchor_caret={2607,0,0,0},tab={2327,0,0,0},target_as_utf8={2447,1,0,8},target_from_selection={2287,0,0,0},target_whole_document={2690,0,0,0},text_height={2279,1,1,0},text_width={2276,1,1,7},toggle_caret_sticky={2459,0,0,0},toggle_fold={2231,0,1,0},toggle_fold_show_text={2700,0,1,7},undo={2176,0,0,0},upper_case={2341,0,0,0},use_pop_up={2371,0,1,0},user_list_show={2117,0,1,7},vc_home={2331,0,0,0},vc_home_display={2652,0,0,0},vc_home_display_extend={2653,0,0,0},vc_home_extend={2332,0,0,0},vc_home_rect_extend={2431,0,0,0},vc_home_wrap={2453,0,0,0},vc_home_wrap_extend={2454,0,0,0},vertical_centre_caret={2619,0,0,0},visible_from_doc_line={2220,1,1,0},word_end_position={2267,1,3,5},word_left={2308,0,0,0},word_left_end={2439,0,0,0},word_left_end_extend={2440,0,0,0},word_left_extend={2309,0,0,0},word_part_left={2390,0,0,0},word_part_left_extend={2391,0,0,0},word_part_right={2392,0,0,0},word_part_right_extend={2393,0,0,0},word_right={2310,0,0,0},word_right_end={2441,0,0,0},word_right_end_extend={2442,0,0,0},word_right_extend={2311,0,0,0},word_start_position={2266,1,3,5},wrap_count={2235,1,1,0},zoom_in={2333,0,0,0},zoom_out={2334,0,0,0},} --- -- Map of Scintilla property names to table values containing their "get" @@ -41,7 +41,7 @@ M.functions = {add_ref_document={2376,0,0,1},add_selection={2573,0,3,3},add_styl -- @see functions -- @class table -- @name properties -M.properties = {accessibility={2703,2702,1,0},additional_caret_fore={2605,2604,4,0},additional_carets_blink={2568,2567,5,0},additional_carets_visible={2609,2608,5,0},additional_sel_alpha={2603,2602,1,0},additional_sel_back={0,2601,4,0},additional_sel_fore={0,2600,4,0},additional_selection_typing={2566,2565,5,0},all_lines_visible={2236,0,5,0},anchor={2009,2026,3,0},annotation_lines={2546,0,1,1},annotation_style={2543,2542,1,1},annotation_style_offset={2551,2550,1,0},annotation_styles={2545,2544,8,1},annotation_text={2541,2540,8,1},annotation_visible={2549,2548,1,0},auto_c_auto_hide={2119,2118,5,0},auto_c_cancel_at_start={2111,2110,5,0},auto_c_case_insensitive_behaviour={2635,2634,1,0},auto_c_choose_single={2114,2113,5,0},auto_c_current={2445,0,1,0},auto_c_current_text={2610,0,8,0},auto_c_drop_rest_of_word={2271,2270,5,0},auto_c_fill_ups={0,2112,7,0},auto_c_ignore_case={2116,2115,5,0},auto_c_max_height={2211,2210,1,0},auto_c_max_width={2209,2208,1,0},auto_c_multi={2637,2636,1,0},auto_c_order={2661,2660,1,0},auto_c_separator={2107,2106,1,0},auto_c_type_separator={2285,2286,1,0},automatic_fold={2664,2663,1,0},back_space_un_indents={2263,2262,5,0},buffered_draw={2034,2035,5,0},call_tip_back={0,2205,4,0},call_tip_fore={0,2206,4,0},call_tip_fore_hlt={0,2207,4,0},call_tip_pos_start={0,2214,1,0},call_tip_position={0,2213,5,0},call_tip_use_style={0,2212,1,0},caret_fore={2138,2069,4,0},caret_line_back={2097,2098,4,0},caret_line_back_alpha={2471,2470,1,0},caret_line_visible={2095,2096,5,0},caret_line_visible_always={2654,2655,5,0},caret_period={2075,2076,1,0},caret_sticky={2457,2458,1,0},caret_style={2513,2512,1,0},caret_width={2189,2188,1,0},char_at={2007,0,1,3},character_pointer={2520,0,1,0},code_page={2137,2037,1,0},column={2129,0,1,3},control_char_symbol={2389,2388,1,0},current_pos={2008,2141,3,0},cursor={2387,2386,1,0},direct_function={2184,0,1,0},direct_pointer={2185,0,1,0},distance_to_secondary_styles={4025,0,1,0},doc_pointer={2357,2358,1,0},edge_colour={2364,2365,4,0},edge_column={2360,2361,1,0},edge_mode={2362,2363,1,0},end_at_last_line={2278,2277,5,0},end_styled={2028,0,3,0},eol_mode={2030,2031,1,0},extra_ascent={2526,2525,1,0},extra_descent={2528,2527,1,0},first_visible_line={2152,2613,1,0},focus={2381,2380,5,0},fold_display_text_style={0,2701,1,0},fold_expanded={2230,2229,5,1},fold_flags={0,2233,1,0},fold_level={2223,2222,1,1},fold_parent={2225,0,1,1},font_quality={2612,2611,1,0},gap_position={2644,0,3,0},h_scroll_bar={2131,2130,5,0},highlight_guide={2135,2134,1,0},hotspot_active_underline={2496,2412,5,0},hotspot_single_line={2497,2421,5,0},identifier={2623,2622,1,0},identifiers={0,4024,7,1},idle_styling={2693,2692,1,0},ime_interaction={2678,2679,1,0},indent={2123,2122,1,0},indentation_guides={2133,2132,1,0},indic_alpha={2524,2523,1,1},indic_flags={2685,2684,1,1},indic_fore={2083,2082,4,1},indic_hover_fore={2683,2682,4,1},indic_hover_style={2681,2680,1,1},indic_outline_alpha={2559,2558,1,1},indic_style={2081,2080,1,1},indic_under={2511,2510,5,1},indicator_current={2501,2500,1,0},indicator_value={2503,2502,1,0},key_words={0,4005,7,1},layout_cache={2273,2272,1,0},length={2006,0,1,0},lexer={4002,4001,1,0},lexer_language={4012,4006,8,0},line_count={2154,0,1,0},line_end_position={2136,0,3,1},line_end_types_active={2658,0,1,0},line_end_types_allowed={2657,2656,1,0},line_end_types_supported={4018,0,1,0},line_indent_position={2128,0,3,1},line_indentation={2127,2126,1,1},line_state={2093,2092,1,1},line_visible={2228,0,5,1},lines_on_screen={2370,0,1,0},main_selection={2575,2574,1,0},margin_back_n={2251,2250,4,1},margin_cursor_n={2249,2248,1,1},margin_left={2156,2155,1,0},margin_mask_n={2245,2244,1,1},margin_options={2557,2539,1,0},margin_right={2158,2157,1,0},margin_sensitive_n={2247,2246,5,1},margin_style={2533,2532,1,1},margin_style_offset={2538,2537,1,0},margin_styles={2535,2534,8,1},margin_text={2531,2530,8,1},margin_type_n={2241,2240,1,1},margin_width_n={2243,2242,1,1},margins={2253,2252,1,0},marker_alpha={0,2476,1,1},marker_back={0,2042,4,1},marker_back_selected={0,2292,4,1},marker_fore={0,2041,4,1},max_line_state={2094,0,1,0},mod_event_mask={2378,2359,1,0},modify={2159,0,5,0},mouse_down_captures={2385,2384,5,0},mouse_dwell_time={2265,2264,1,0},mouse_selection_rectangular_switch={2669,2668,5,0},mouse_wheel_captures={2697,2696,5,0},multi_paste={2615,2614,1,0},multiple_selection={2564,2563,5,0},overtype={2187,2186,5,0},paste_convert_endings={2468,2467,5,0},phases_draw={2673,2674,1,0},position_cache={2515,2514,1,0},primary_style_from_style={4028,0,1,1},print_colour_mode={2149,2148,1,0},print_magnification={2147,2146,1,0},print_wrap_mode={2407,2406,1,0},property={4008,4004,8,7},property_expanded={4009,0,8,7},property_int={4010,0,1,7},punctuation_chars={2649,2648,8,0},range_pointer={2643,0,1,3},read_only={2140,2171,5,0},rectangular_selection_anchor={2591,2590,3,0},rectangular_selection_anchor_virtual_space={2595,2594,1,0},rectangular_selection_caret={2589,2588,3,0},rectangular_selection_caret_virtual_space={2593,2592,1,0},rectangular_selection_modifier={2599,2598,1,0},representation={2666,2665,8,7},rgba_image_height={0,2625,1,0},rgba_image_scale={0,2651,1,0},rgba_image_width={0,2624,1,0},scroll_width={2275,2274,1,0},scroll_width_tracking={2517,2516,5,0},search_flags={2199,2198,1,0},sel_alpha={2477,2478,1,0},sel_eol_filled={2479,2480,5,0},selection_empty={2650,0,5,0},selection_end={2145,2144,3,0},selection_is_rectangle={2372,0,5,0},selection_mode={2423,2422,1,0},selection_n_anchor={2579,2578,3,1},selection_n_anchor_virtual_space={2583,2582,1,1},selection_n_caret={2577,2576,3,1},selection_n_caret_virtual_space={2581,2580,1,1},selection_n_end={2587,2586,3,1},selection_n_start={2585,2584,3,1},selection_start={2143,2142,3,0},selections={2570,0,1,0},status={2383,2382,1,0},style_at={2010,0,1,3},style_back={2482,2052,4,1},style_bits={2091,2090,1,0},style_bits_needed={4011,0,1,0},style_bold={2483,2053,5,1},style_case={2489,2060,1,1},style_changeable={2492,2099,5,1},style_character_set={2490,2066,1,1},style_eol_filled={2487,2057,5,1},style_font={2486,2056,8,1},style_fore={2481,2051,4,1},style_from_sub_style={4027,0,1,1},style_hot_spot={2493,2409,5,1},style_italic={2484,2054,5,1},style_size={2485,2055,1,1},style_size_fractional={2062,2061,1,1},style_underline={2488,2059,5,1},style_visible={2491,2074,5,1},style_weight={2064,2063,1,1},sub_style_bases={4026,0,8,0},sub_styles_length={4022,0,1,1},sub_styles_start={4021,0,1,1},tab_draw_mode={2698,2699,1,0},tab_indents={2261,2260,5,0},tab_width={2121,2036,1,0},tag={2616,0,8,1},target_end={2193,2192,3,0},target_start={2191,2190,3,0},target_text={2687,0,8,0},technology={2631,2630,1,0},text_length={2183,0,1,0},two_phase_draw={2283,2284,5,0},undo_collection={2019,2012,5,0},use_tabs={2125,2124,5,0},v_scroll_bar={2281,2280,5,0},view_eol={2355,2356,5,0},view_ws={2020,2021,1,0},virtual_space_options={2597,2596,1,0},whitespace_chars={2647,2443,8,0},whitespace_size={2087,2086,1,0},word_chars={2646,2077,8,0},wrap_indent_mode={2473,2472,1,0},wrap_mode={2269,2268,1,0},wrap_start_indent={2465,2464,1,0},wrap_visual_flags={2461,2460,1,0},wrap_visual_flags_location={2463,2462,1,0},x_offset={2398,2397,1,0},zoom={2374,2373,1,0},} +M.properties = {accessibility={2703,2702,1,0},additional_caret_fore={2605,2604,4,0},additional_carets_blink={2568,2567,5,0},additional_carets_visible={2609,2608,5,0},additional_sel_alpha={2603,2602,1,0},additional_sel_back={0,2601,4,0},additional_sel_fore={0,2600,4,0},additional_selection_typing={2566,2565,5,0},all_lines_visible={2236,0,5,0},anchor={2009,2026,3,0},annotation_lines={2546,0,1,1},annotation_style={2543,2542,1,1},annotation_style_offset={2551,2550,1,0},annotation_styles={2545,2544,8,1},annotation_text={2541,2540,8,1},annotation_visible={2549,2548,1,0},auto_c_auto_hide={2119,2118,5,0},auto_c_cancel_at_start={2111,2110,5,0},auto_c_case_insensitive_behaviour={2635,2634,1,0},auto_c_choose_single={2114,2113,5,0},auto_c_current={2445,0,1,0},auto_c_current_text={2610,0,8,0},auto_c_drop_rest_of_word={2271,2270,5,0},auto_c_fill_ups={0,2112,7,0},auto_c_ignore_case={2116,2115,5,0},auto_c_max_height={2211,2210,1,0},auto_c_max_width={2209,2208,1,0},auto_c_multi={2637,2636,1,0},auto_c_order={2661,2660,1,0},auto_c_separator={2107,2106,1,0},auto_c_type_separator={2285,2286,1,0},automatic_fold={2664,2663,1,0},back_space_un_indents={2263,2262,5,0},buffered_draw={2034,2035,5,0},call_tip_back={0,2205,4,0},call_tip_fore={0,2206,4,0},call_tip_fore_hlt={0,2207,4,0},call_tip_pos_start={0,2214,1,0},call_tip_position={0,2213,5,0},call_tip_use_style={0,2212,1,0},caret_fore={2138,2069,4,0},caret_line_back={2097,2098,4,0},caret_line_back_alpha={2471,2470,1,0},caret_line_frame={2704,2705,1,0},caret_line_visible={2095,2096,5,0},caret_line_visible_always={2654,2655,5,0},caret_period={2075,2076,1,0},caret_sticky={2457,2458,1,0},caret_style={2513,2512,1,0},caret_width={2189,2188,1,0},char_at={2007,0,1,3},character_pointer={2520,0,1,0},code_page={2137,2037,1,0},column={2129,0,1,3},control_char_symbol={2389,2388,1,0},current_pos={2008,2141,3,0},cursor={2387,2386,1,0},direct_function={2184,0,1,0},direct_pointer={2185,0,1,0},distance_to_secondary_styles={4025,0,1,0},doc_pointer={2357,2358,1,0},edge_colour={2364,2365,4,0},edge_column={2360,2361,1,0},edge_mode={2362,2363,1,0},end_at_last_line={2278,2277,5,0},end_styled={2028,0,3,0},eol_mode={2030,2031,1,0},extra_ascent={2526,2525,1,0},extra_descent={2528,2527,1,0},first_visible_line={2152,2613,1,0},focus={2381,2380,5,0},fold_display_text_style={0,2701,1,0},fold_expanded={2230,2229,5,1},fold_flags={0,2233,1,0},fold_level={2223,2222,1,1},fold_parent={2225,0,1,1},font_quality={2612,2611,1,0},gap_position={2644,0,3,0},h_scroll_bar={2131,2130,5,0},highlight_guide={2135,2134,1,0},hotspot_active_underline={2496,2412,5,0},hotspot_single_line={2497,2421,5,0},identifier={2623,2622,1,0},identifiers={0,4024,7,1},idle_styling={2693,2692,1,0},ime_interaction={2678,2679,1,0},indent={2123,2122,1,0},indentation_guides={2133,2132,1,0},indic_alpha={2524,2523,1,1},indic_flags={2685,2684,1,1},indic_fore={2083,2082,4,1},indic_hover_fore={2683,2682,4,1},indic_hover_style={2681,2680,1,1},indic_outline_alpha={2559,2558,1,1},indic_style={2081,2080,1,1},indic_under={2511,2510,5,1},indicator_current={2501,2500,1,0},indicator_value={2503,2502,1,0},key_words={0,4005,7,1},layout_cache={2273,2272,1,0},length={2006,0,1,0},lexer={4002,4001,1,0},lexer_language={4012,4006,8,0},line_count={2154,0,1,0},line_end_position={2136,0,3,1},line_end_types_active={2658,0,1,0},line_end_types_allowed={2657,2656,1,0},line_end_types_supported={4018,0,1,0},line_indent_position={2128,0,3,1},line_indentation={2127,2126,1,1},line_state={2093,2092,1,1},line_visible={2228,0,5,1},lines_on_screen={2370,0,1,0},main_selection={2575,2574,1,0},margin_back_n={2251,2250,4,1},margin_cursor_n={2249,2248,1,1},margin_left={2156,2155,1,0},margin_mask_n={2245,2244,1,1},margin_options={2557,2539,1,0},margin_right={2158,2157,1,0},margin_sensitive_n={2247,2246,5,1},margin_style={2533,2532,1,1},margin_style_offset={2538,2537,1,0},margin_styles={2535,2534,8,1},margin_text={2531,2530,8,1},margin_type_n={2241,2240,1,1},margin_width_n={2243,2242,1,1},margins={2253,2252,1,0},marker_alpha={0,2476,1,1},marker_back={0,2042,4,1},marker_back_selected={0,2292,4,1},marker_fore={0,2041,4,1},max_line_state={2094,0,1,0},mod_event_mask={2378,2359,1,0},modify={2159,0,5,0},mouse_down_captures={2385,2384,5,0},mouse_dwell_time={2265,2264,1,0},mouse_selection_rectangular_switch={2669,2668,5,0},mouse_wheel_captures={2697,2696,5,0},multi_paste={2615,2614,1,0},multiple_selection={2564,2563,5,0},overtype={2187,2186,5,0},paste_convert_endings={2468,2467,5,0},phases_draw={2673,2674,1,0},position_cache={2515,2514,1,0},primary_style_from_style={4028,0,1,1},print_colour_mode={2149,2148,1,0},print_magnification={2147,2146,1,0},print_wrap_mode={2407,2406,1,0},property={4008,4004,8,7},property_expanded={4009,0,8,7},property_int={4010,0,1,7},punctuation_chars={2649,2648,8,0},range_pointer={2643,0,1,3},read_only={2140,2171,5,0},rectangular_selection_anchor={2591,2590,3,0},rectangular_selection_anchor_virtual_space={2595,2594,1,0},rectangular_selection_caret={2589,2588,3,0},rectangular_selection_caret_virtual_space={2593,2592,1,0},rectangular_selection_modifier={2599,2598,1,0},representation={2666,2665,8,7},rgba_image_height={0,2625,1,0},rgba_image_scale={0,2651,1,0},rgba_image_width={0,2624,1,0},scroll_width={2275,2274,1,0},scroll_width_tracking={2517,2516,5,0},search_flags={2199,2198,1,0},sel_alpha={2477,2478,1,0},sel_eol_filled={2479,2480,5,0},selection_empty={2650,0,5,0},selection_end={2145,2144,3,0},selection_is_rectangle={2372,0,5,0},selection_mode={2423,2422,1,0},selection_n_anchor={2579,2578,3,1},selection_n_anchor_virtual_space={2583,2582,1,1},selection_n_caret={2577,2576,3,1},selection_n_caret_virtual_space={2581,2580,1,1},selection_n_end={2587,2586,3,1},selection_n_start={2585,2584,3,1},selection_start={2143,2142,3,0},selections={2570,0,1,0},status={2383,2382,1,0},style_at={2010,0,1,3},style_back={2482,2052,4,1},style_bits={2091,2090,1,0},style_bits_needed={4011,0,1,0},style_bold={2483,2053,5,1},style_case={2489,2060,1,1},style_changeable={2492,2099,5,1},style_character_set={2490,2066,1,1},style_eol_filled={2487,2057,5,1},style_font={2486,2056,8,1},style_fore={2481,2051,4,1},style_from_sub_style={4027,0,1,1},style_hot_spot={2493,2409,5,1},style_italic={2484,2054,5,1},style_size={2485,2055,1,1},style_size_fractional={2062,2061,1,1},style_underline={2488,2059,5,1},style_visible={2491,2074,5,1},style_weight={2064,2063,1,1},sub_style_bases={4026,0,8,0},sub_styles_length={4022,0,1,1},sub_styles_start={4021,0,1,1},tab_draw_mode={2698,2699,1,0},tab_indents={2261,2260,5,0},tab_width={2121,2036,1,0},tag={2616,0,8,1},target_end={2193,2192,3,0},target_start={2191,2190,3,0},target_text={2687,0,8,0},technology={2631,2630,1,0},text_length={2183,0,1,0},two_phase_draw={2283,2284,5,0},undo_collection={2019,2012,5,0},use_tabs={2125,2124,5,0},v_scroll_bar={2281,2280,5,0},view_eol={2355,2356,5,0},view_ws={2020,2021,1,0},virtual_space_options={2597,2596,1,0},whitespace_chars={2647,2443,8,0},whitespace_size={2087,2086,1,0},word_chars={2646,2077,8,0},wrap_indent_mode={2473,2472,1,0},wrap_mode={2269,2268,1,0},wrap_start_indent={2465,2464,1,0},wrap_visual_flags={2461,2460,1,0},wrap_visual_flags_location={2463,2462,1,0},x_offset={2398,2397,1,0},zoom={2374,2373,1,0},} local marker_number, indic_number, list_type, image_type = -1, -1, 0, 0 diff --git a/src/scintilla_backports/6145_b3eaa82b3750.patch b/src/scintilla_backports/6145_b3eaa82b3750.patch new file mode 100644 index 00000000..dcc41362 --- /dev/null +++ b/src/scintilla_backports/6145_b3eaa82b3750.patch @@ -0,0 +1,1426 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1490250637 -39600 +# Node ID b3eaa82b3750a3b4159838fee4180139554d4544 +# Parent 3115ddbbf95d0ea06e5dd8ecba8fbafb1cad639d +Updated case conversion and character categories to Unicode 9. + +diff -r 3115ddbbf95d -r b3eaa82b3750 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Tue Mar 21 09:59:45 2017 +1100 ++++ b/doc/ScintillaHistory.html Thu Mar 23 17:30:37 2017 +1100 +@@ -527,6 +527,17 @@ + Released 21 March 2017. + </li> + <li> ++ Updated case conversion and character categories to Unicode 9. ++ </li> ++ </ul> ++ <h3> ++ <a href="http://www.scintilla.org/scite374.zip">Release 3.7.4</a> ++ </h3> ++ <ul> ++ <li> ++ Released 21 March 2017. ++ </li> ++ <li> + Requires a C++11 compiler. GCC 4.8 and MSVC 2015 are supported. + </li> + <li> +diff -r 3115ddbbf95d -r b3eaa82b3750 lexlib/CharacterCategory.cxx +--- a/lexlib/CharacterCategory.cxx Tue Mar 21 09:59:45 2017 +1100 ++++ b/lexlib/CharacterCategory.cxx Thu Mar 23 17:30:37 2017 +1100 +@@ -21,7 +21,7 @@ + + const int catRanges[] = { + //++Autogenerated -- start of section automatically generated +-// Created with Python 3.3.0, Unicode 6.1.0 ++// Created with Python 3.6.1, Unicode 9.0.0 + 25, + 1046, + 1073, +@@ -395,7 +395,8 @@ + 28483, + 28513, + 28625, +-28669, ++28640, ++28701, + 28820, + 28864, + 28913, +@@ -639,7 +640,15 @@ + 42145, + 42176, + 42209, +-42269, ++42240, ++42273, ++42304, ++42337, ++42368, ++42401, ++42432, ++42465, ++42525, + 42528, + 43773, + 43811, +@@ -650,6 +659,7 @@ + 45361, + 45388, + 45437, ++45493, + 45555, + 45597, + 45605, +@@ -668,7 +678,6 @@ + 48753, + 48829, + 49178, +-49341, + 49362, + 49457, + 49523, +@@ -676,7 +685,8 @@ + 49621, + 49669, + 50033, +-50077, ++50074, ++50109, + 50129, + 50180, + 51203, +@@ -739,12 +749,12 @@ + 68561, + 68605, + 70660, +-70717, +-70724, +-71101, +-72837, +-73725, +-73733, ++71357, ++71364, ++71645, ++72325, ++72794, ++72805, + 73830, + 73860, + 75589, +@@ -765,9 +775,6 @@ + 77329, + 77347, + 77380, +-77597, +-77604, +-77853, + 77861, + 77894, + 77981, +@@ -880,6 +887,8 @@ + 89617, + 89651, + 89693, ++89892, ++89949, + 90149, + 90182, + 90269, +@@ -960,6 +969,7 @@ + 98099, + 98133, + 98173, ++98309, + 98342, + 98461, + 98468, +@@ -969,8 +979,6 @@ + 98884, + 99645, + 99652, +-99997, +-100004, + 100189, + 100260, + 100293, +@@ -983,7 +991,7 @@ + 101029, + 101117, + 101124, +-101213, ++101245, + 101380, + 101445, + 101533, +@@ -991,7 +999,8 @@ + 101917, + 102154, + 102389, +-102429, ++102404, ++102437, + 102470, + 102557, + 102564, +@@ -1027,6 +1036,7 @@ + 106013, + 106020, + 106109, ++106533, + 106566, + 106653, + 106660, +@@ -1044,15 +1054,16 @@ + 108870, + 108965, + 108996, +-109053, ++109045, ++109085, ++109188, + 109286, +-109341, +-109572, ++109322, ++109540, + 109637, + 109725, + 109768, + 110090, +-110301, + 110389, + 110404, + 110621, +@@ -1077,6 +1088,8 @@ + 113405, + 113414, + 113693, ++113864, ++114205, + 114246, + 114321, + 114365, +@@ -1260,8 +1273,10 @@ + 159748, + 160277, + 160605, +-160772, +-163517, ++160768, ++163549, ++163585, ++163805, + 163852, + 163876, + 183729, +@@ -1274,7 +1289,8 @@ + 185348, + 187761, + 187849, +-187965, ++187940, ++188221, + 188420, + 188861, + 188868, +@@ -1316,7 +1332,7 @@ + 196812, + 196849, + 196965, +-197078, ++197082, + 197117, + 197128, + 197469, +@@ -1325,13 +1341,15 @@ + 198788, + 200477, + 200708, ++200869, ++200932, + 202021, + 202052, + 202109, + 202244, + 204509, + 204804, +-205757, ++205821, + 205829, + 205926, + 206053, +@@ -1352,9 +1370,7 @@ + 208573, + 208900, + 210333, +-210438, +-210980, +-211206, ++210436, + 211293, + 211464, + 211786, +@@ -1363,6 +1379,7 @@ + 212996, + 213733, + 213798, ++213861, + 213917, + 213969, + 214020, +@@ -1388,6 +1405,9 @@ + 218339, + 218385, + 218589, ++218629, ++219079, ++219133, + 221189, + 221318, + 221348, +@@ -1416,7 +1436,6 @@ + 226565, + 226630, + 226661, +-226694, + 226756, + 226824, + 227140, +@@ -1444,7 +1463,8 @@ + 232260, + 233219, + 233425, +-233501, ++233473, ++233789, + 235537, + 235805, + 236037, +@@ -1459,6 +1479,8 @@ + 237189, + 237220, + 237309, ++237317, ++237405, + 237569, + 238979, + 240993, +@@ -1466,8 +1488,8 @@ + 241441, + 242531, + 243717, +-244989, +-245637, ++245469, ++245605, + 245760, + 245793, + 245824, +@@ -1812,7 +1834,7 @@ + 265206, + 265242, + 265405, +-265562, ++265434, + 265738, + 265763, + 265821, +@@ -1829,7 +1851,7 @@ + 266755, + 267197, + 267283, +-268125, ++268285, + 268805, + 269223, + 269349, +@@ -1882,7 +1904,8 @@ + 274561, + 274601, + 274730, +-274781, ++274773, ++274845, + 274962, + 275125, + 275282, +@@ -1903,7 +1926,10 @@ + 277173, + 278162, + 286741, +-286994, ++286989, ++287022, ++287053, ++287086, + 287125, + 287762, + 287829, +@@ -1916,7 +1942,7 @@ + 292501, + 293778, + 293973, +-294557, ++294909, + 294933, + 296189, + 296981, +@@ -1933,8 +1959,6 @@ + 311317, + 314866, + 314901, +-319517, +-319541, + 322829, + 322862, + 322893, +@@ -2003,9 +2027,18 @@ + 353810, + 354485, + 354546, +-354749, +-354837, +-355165, ++354741, ++355997, ++356053, ++357085, ++357141, ++358237, ++358325, ++358717, ++358741, ++359005, ++359829, ++359965, + 360448, + 361981, + 361985, +@@ -2203,7 +2236,12 @@ + 378339, + 378385, + 378700, +-378781, ++378769, ++378892, ++378929, ++378957, ++378993, ++379069, + 380949, + 381789, + 381813, +@@ -2295,7 +2333,7 @@ + 636637, + 636949, + 638980, +-1309117, ++1309405, + 1310724, + 1311395, + 1311428, +@@ -2389,8 +2427,12 @@ + 1364641, + 1364672, + 1364705, +-1364765, +-1364965, ++1364736, ++1364769, ++1364800, ++1364833, ++1364867, ++1364933, + 1364996, + 1367241, + 1367557, +@@ -2497,12 +2539,21 @@ + 1372545, + 1372576, + 1372609, +-1372669, ++1372644, + 1372672, + 1372705, + 1372736, + 1372769, +-1372829, ++1372864, ++1372897, ++1372928, ++1372961, ++1372992, ++1373025, ++1373056, ++1373089, ++1373120, ++1373153, + 1373184, + 1373217, + 1373248, +@@ -2514,7 +2565,13 @@ + 1373440, + 1373473, + 1373504, +-1373565, ++1373693, ++1373696, ++1373857, ++1373888, ++1373921, ++1373981, ++1375972, + 1376003, + 1376065, + 1376100, +@@ -2541,7 +2598,7 @@ + 1380420, + 1382022, + 1382533, +-1382589, ++1382621, + 1382865, + 1382920, + 1383261, +@@ -2549,7 +2606,9 @@ + 1384004, + 1384209, + 1384292, +-1384349, ++1384337, ++1384356, ++1384413, + 1384456, + 1384772, + 1385669, +@@ -2576,7 +2635,13 @@ + 1391112, + 1391453, + 1391569, +-1391645, ++1391620, ++1391781, ++1391811, ++1391844, ++1392136, ++1392452, ++1392637, + 1392644, + 1393957, + 1394150, +@@ -2599,8 +2664,9 @@ + 1396469, + 1396548, + 1396582, +-1396637, +-1396740, ++1396613, ++1396646, ++1396676, + 1398277, + 1398308, + 1398341, +@@ -2635,6 +2701,12 @@ + 1402109, + 1402116, + 1402365, ++1402369, ++1403764, ++1403779, ++1403905, ++1404125, ++1404417, + 1406980, + 1408102, + 1408165, +@@ -2681,8 +2753,8 @@ + 2061908, + 2062429, + 2062948, +-2074573, +-2074606, ++2074574, ++2074605, + 2074653, + 2075140, + 2077213, +@@ -2699,7 +2771,6 @@ + 2081585, + 2081629, + 2081797, +-2082045, + 2082321, + 2082348, + 2082411, +@@ -2831,9 +2902,12 @@ + 2109098, + 2109237, + 2109770, +-2109821, ++2109845, ++2109949, + 2109973, + 2110365, ++2110485, ++2110525, + 2112021, + 2113445, + 2113501, +@@ -2841,8 +2915,10 @@ + 2118589, + 2118660, + 2120253, ++2120709, ++2120746, ++2121629, + 2121732, +-2122749, + 2122762, + 2122909, + 2123268, +@@ -2850,6 +2926,9 @@ + 2123844, + 2124105, + 2124157, ++2124292, ++2125509, ++2125693, + 2125828, + 2126813, + 2126833, +@@ -2865,6 +2944,22 @@ + 2135005, + 2135048, + 2135389, ++2135552, ++2136733, ++2136833, ++2138013, ++2138116, ++2139421, ++2139652, ++2141341, ++2141681, ++2141725, ++2146308, ++2156285, ++2156548, ++2157277, ++2157572, ++2157853, + 2162692, + 2162909, + 2162948, +@@ -2879,7 +2974,18 @@ + 2165469, + 2165489, + 2165514, +-2165789, ++2165764, ++2166517, ++2166570, ++2166788, ++2167805, ++2168042, ++2168349, ++2169860, ++2170493, ++2170500, ++2170589, ++2170730, + 2170884, + 2171594, + 2171805, +@@ -2890,8 +2996,11 @@ + 2172957, + 2174980, + 2176797, ++2176906, + 2176964, +-2177053, ++2177034, ++2177565, ++2177610, + 2179076, + 2179109, + 2179229, +@@ -2914,7 +3023,17 @@ + 2182148, + 2183082, + 2183153, +-2183197, ++2183172, ++2184106, ++2184221, ++2185220, ++2185493, ++2185508, ++2186405, ++2186493, ++2186602, ++2186769, ++2187005, + 2187268, + 2189021, + 2189105, +@@ -2924,9 +3043,20 @@ + 2190340, + 2190973, + 2191114, +-2191389, ++2191364, ++2191965, ++2192177, ++2192317, ++2192682, ++2192925, + 2195460, + 2197821, ++2199552, ++2201213, ++2201601, ++2203261, ++2203466, ++2203677, + 2214922, + 2215933, + 2228230, +@@ -2939,7 +3069,7 @@ + 2230858, + 2231496, + 2231837, +-2232325, ++2232293, + 2232390, + 2232420, + 2233862, +@@ -2963,6 +3093,11 @@ + 2238152, + 2238481, + 2238621, ++2238980, ++2240101, ++2240145, ++2240196, ++2240253, + 2240517, + 2240582, + 2240612, +@@ -2971,9 +3106,139 @@ + 2242534, + 2242596, + 2242737, +-2242877, ++2242885, ++2242993, ++2243037, + 2243080, +-2243421, ++2243396, ++2243441, ++2243460, ++2243505, ++2243613, ++2243626, ++2244285, ++2244612, ++2245213, ++2245220, ++2246022, ++2246117, ++2246214, ++2246277, ++2246310, ++2246341, ++2246417, ++2246597, ++2246653, ++2248708, ++2248957, ++2248964, ++2249021, ++2249028, ++2249181, ++2249188, ++2249693, ++2249700, ++2250033, ++2250077, ++2250244, ++2251749, ++2251782, ++2251877, ++2252157, ++2252296, ++2252637, ++2252805, ++2252870, ++2252957, ++2252964, ++2253245, ++2253284, ++2253373, ++2253412, ++2254141, ++2254148, ++2254397, ++2254404, ++2254493, ++2254500, ++2254685, ++2254725, ++2254756, ++2254790, ++2254853, ++2254886, ++2255037, ++2255078, ++2255165, ++2255206, ++2255325, ++2255364, ++2255421, ++2255590, ++2255645, ++2255780, ++2255942, ++2256029, ++2256069, ++2256317, ++2256389, ++2256573, ++2260996, ++2262694, ++2262789, ++2263046, ++2263109, ++2263206, ++2263237, ++2263268, ++2263409, ++2263560, ++2263901, ++2263921, ++2263965, ++2263985, ++2264029, ++2265092, ++2266630, ++2266725, ++2266918, ++2266949, ++2266982, ++2267109, ++2267174, ++2267205, ++2267268, ++2267345, ++2267364, ++2267421, ++2267656, ++2267997, ++2273284, ++2274790, ++2274885, ++2275037, ++2275078, ++2275205, ++2275270, ++2275301, ++2275377, ++2276100, ++2276229, ++2276317, ++2277380, ++2278918, ++2279013, ++2279270, ++2279333, ++2279366, ++2279397, ++2279473, ++2279556, ++2279613, ++2279944, ++2280285, ++2280465, ++2280893, + 2281476, + 2282853, + 2282886, +@@ -2985,16 +3250,96 @@ + 2283293, + 2283528, + 2283869, ++2285572, ++2286429, ++2286501, ++2286598, ++2286661, ++2286790, ++2286821, ++2287005, ++2287112, ++2287434, ++2287505, ++2287605, ++2287645, ++2298880, ++2299905, ++2300936, ++2301258, ++2301565, ++2301924, ++2301981, ++2316292, ++2318141, ++2326532, ++2326845, ++2326852, ++2328038, ++2328069, ++2328317, ++2328325, ++2328518, ++2328549, ++2328580, ++2328625, ++2328797, ++2329096, ++2329418, ++2330045, ++2330129, ++2330180, ++2331165, ++2331205, ++2331933, ++2331942, ++2331973, ++2332198, ++2332229, ++2332294, ++2332325, ++2332413, + 2359300, +-2387453, ++2388829, + 2392073, +-2395261, ++2395645, + 2395665, +-2395805, ++2395837, ++2396164, ++2402461, + 2490372, + 2524669, ++2654212, ++2672893, + 2949124, + 2967357, ++2967556, ++2968573, ++2968584, ++2968925, ++2969041, ++2969117, ++2972164, ++2973149, ++2973189, ++2973361, ++2973405, ++2973700, ++2975237, ++2975473, ++2975637, ++2975747, ++2975889, ++2975925, ++2975965, ++2976264, ++2976605, ++2976618, ++2976861, ++2976868, ++2977565, ++2977700, ++2978333, + 3006468, + 3008701, + 3009028, +@@ -3003,8 +3348,27 @@ + 3011045, + 3011171, + 3011613, ++3013635, ++3013693, ++3014660, ++3210685, ++3211268, ++3235453, + 3538948, + 3539037, ++3637252, ++3640701, ++3640836, ++3641277, ++3641348, ++3641661, ++3641860, ++3642205, ++3642261, ++3642277, ++3642353, ++3642394, ++3642525, + 3801109, + 3808989, + 3809301, +@@ -3021,7 +3385,7 @@ + 3813781, + 3814725, + 3814869, +-3816413, ++3816765, + 3817493, + 3819589, + 3819701, +@@ -3120,7 +3484,44 @@ + 3864929, + 3864989, + 3865032, +-3866653, ++3866645, ++3883013, ++3884789, ++3884901, ++3886517, ++3886757, ++3886805, ++3887237, ++3887285, ++3887345, ++3887517, ++3887973, ++3888157, ++3888165, ++3888669, ++3932165, ++3932413, ++3932421, ++3932989, ++3933029, ++3933277, ++3933285, ++3933373, ++3933381, ++3933565, ++3997700, ++4004029, ++4004074, ++4004357, ++4004605, ++4005888, ++4006977, ++4008069, ++4008317, ++4008456, ++4008797, ++4008913, ++4008989, + 4046852, + 4047005, + 4047012, +@@ -3196,69 +3597,73 @@ + 4068373, + 4068861, + 4068917, +-4069373, ++4069405, + 4069429, + 4069917, + 4069941, +-4070429, ++4071133, + 4071434, +-4071805, ++4071869, + 4071957, + 4072957, + 4072981, + 4074909, + 4075029, +-4076413, ++4076989, + 4078805, + 4079741, + 4080149, +-4081533, ++4081565, + 4081685, + 4081981, + 4082197, + 4082269, + 4087829, +-4088893, +-4089365, +-4089565, +-4089589, +-4091837, +-4091925, +-4092573, +-4092949, +-4094141, +-4094165, +-4094333, +-4094997, +-4095549, ++4095860, + 4096021, +-4098045, +-4098069, +-4098109, +-4098133, +-4103965, +-4103989, +-4104125, +-4104213, +-4106205, +-4106261, +-4106397, +-4106773, +-4107549, +-4112245, +-4114493, +-4114613, +-4114973, +-4116501, +-4118749, ++4119165, ++4119573, ++4119997, ++4120085, ++4120317, + 4120597, + 4124317, ++4124693, ++4127421, ++4128789, ++4129181, ++4129301, ++4131101, ++4131349, ++4131677, ++4131861, ++4133149, ++4133397, ++4134365, ++4137493, ++4137981, ++4138005, ++4138269, ++4138517, ++4138557, ++4138613, ++4139005, ++4139029, ++4139421, ++4139541, ++4140029, ++4141077, ++4141661, ++4143125, ++4143165, + 4194308, + 5561085, + 5562372, + 5695165, + 5695492, + 5702621, ++5702660, ++5887069, + 6225924, + 6243293, + 29360186, +diff -r 3115ddbbf95d -r b3eaa82b3750 src/CaseConvert.cxx +--- a/src/CaseConvert.cxx Tue Mar 21 09:59:45 2017 +1100 ++++ b/src/CaseConvert.cxx Thu Mar 23 17:30:37 2017 +1100 +@@ -56,7 +56,7 @@ + 1121,1120,17,2, + 1163,1162,27,2, + 1218,1217,7,2, +-1233,1232,44,2, ++1233,1232,48,2, + 1377,1329,38,1, + 7681,7680,75,2, + 7841,7840,48,2, +@@ -72,13 +72,17 @@ + 11393,11392,50,2, + 11520,4256,38,1, + 42561,42560,23,2, +-42625,42624,12,2, ++42625,42624,14,2, + 42787,42786,7,2, + 42803,42802,31,2, + 42879,42878,5,2, +-42913,42912,5,2, ++42903,42902,10,2, + 65345,65313,26,1, + 66600,66560,40,1, ++66776,66736,36,1, ++68800,68736,51,1, ++71872,71840,32,1, ++125218,125184,34,1, + + //--Autogenerated -- end of section automatically generated + }; +@@ -137,13 +141,17 @@ + 599,394, + 601,399, + 603,400, ++604,42923, + 608,403, ++609,42924, + 611,404, + 613,42893, + 614,42922, + 616,407, + 617,406, ++618,42926, + 619,11362, ++620,42925, + 623,412, + 625,11374, + 626,413, +@@ -151,12 +159,15 @@ + 637,11364, + 640,422, + 643,425, ++647,42929, + 648,430, + 649,580, + 650,433, + 651,434, + 652,581, + 658,439, ++669,42930, ++670,42928, + 881,880, + 883,882, + 887,886, +@@ -172,6 +183,7 @@ + 974,911, + 983,975, + 1010,1017, ++1011,895, + 1016,1015, + 1019,1018, + 1231,1216, +@@ -222,6 +234,9 @@ + 42892,42891, + 42897,42896, + 42899,42898, ++42933,42932, ++42935,42934, ++43859,42931, + + //--Autogenerated -- end of section automatically generated + }; +@@ -259,6 +274,107 @@ + "\xcf\xb4|\xce\xb8||\xce\xb8|" + "\xcf\xb5|\xce\xb5|\xce\x95||" + "\xd6\x87|\xd5\xa5\xd6\x82|\xd4\xb5\xd5\x92||" ++"\xe1\x8e\xa0|||\xea\xad\xb0|" ++"\xe1\x8e\xa1|||\xea\xad\xb1|" ++"\xe1\x8e\xa2|||\xea\xad\xb2|" ++"\xe1\x8e\xa3|||\xea\xad\xb3|" ++"\xe1\x8e\xa4|||\xea\xad\xb4|" ++"\xe1\x8e\xa5|||\xea\xad\xb5|" ++"\xe1\x8e\xa6|||\xea\xad\xb6|" ++"\xe1\x8e\xa7|||\xea\xad\xb7|" ++"\xe1\x8e\xa8|||\xea\xad\xb8|" ++"\xe1\x8e\xa9|||\xea\xad\xb9|" ++"\xe1\x8e\xaa|||\xea\xad\xba|" ++"\xe1\x8e\xab|||\xea\xad\xbb|" ++"\xe1\x8e\xac|||\xea\xad\xbc|" ++"\xe1\x8e\xad|||\xea\xad\xbd|" ++"\xe1\x8e\xae|||\xea\xad\xbe|" ++"\xe1\x8e\xaf|||\xea\xad\xbf|" ++"\xe1\x8e\xb0|||\xea\xae\x80|" ++"\xe1\x8e\xb1|||\xea\xae\x81|" ++"\xe1\x8e\xb2|||\xea\xae\x82|" ++"\xe1\x8e\xb3|||\xea\xae\x83|" ++"\xe1\x8e\xb4|||\xea\xae\x84|" ++"\xe1\x8e\xb5|||\xea\xae\x85|" ++"\xe1\x8e\xb6|||\xea\xae\x86|" ++"\xe1\x8e\xb7|||\xea\xae\x87|" ++"\xe1\x8e\xb8|||\xea\xae\x88|" ++"\xe1\x8e\xb9|||\xea\xae\x89|" ++"\xe1\x8e\xba|||\xea\xae\x8a|" ++"\xe1\x8e\xbb|||\xea\xae\x8b|" ++"\xe1\x8e\xbc|||\xea\xae\x8c|" ++"\xe1\x8e\xbd|||\xea\xae\x8d|" ++"\xe1\x8e\xbe|||\xea\xae\x8e|" ++"\xe1\x8e\xbf|||\xea\xae\x8f|" ++"\xe1\x8f\x80|||\xea\xae\x90|" ++"\xe1\x8f\x81|||\xea\xae\x91|" ++"\xe1\x8f\x82|||\xea\xae\x92|" ++"\xe1\x8f\x83|||\xea\xae\x93|" ++"\xe1\x8f\x84|||\xea\xae\x94|" ++"\xe1\x8f\x85|||\xea\xae\x95|" ++"\xe1\x8f\x86|||\xea\xae\x96|" ++"\xe1\x8f\x87|||\xea\xae\x97|" ++"\xe1\x8f\x88|||\xea\xae\x98|" ++"\xe1\x8f\x89|||\xea\xae\x99|" ++"\xe1\x8f\x8a|||\xea\xae\x9a|" ++"\xe1\x8f\x8b|||\xea\xae\x9b|" ++"\xe1\x8f\x8c|||\xea\xae\x9c|" ++"\xe1\x8f\x8d|||\xea\xae\x9d|" ++"\xe1\x8f\x8e|||\xea\xae\x9e|" ++"\xe1\x8f\x8f|||\xea\xae\x9f|" ++"\xe1\x8f\x90|||\xea\xae\xa0|" ++"\xe1\x8f\x91|||\xea\xae\xa1|" ++"\xe1\x8f\x92|||\xea\xae\xa2|" ++"\xe1\x8f\x93|||\xea\xae\xa3|" ++"\xe1\x8f\x94|||\xea\xae\xa4|" ++"\xe1\x8f\x95|||\xea\xae\xa5|" ++"\xe1\x8f\x96|||\xea\xae\xa6|" ++"\xe1\x8f\x97|||\xea\xae\xa7|" ++"\xe1\x8f\x98|||\xea\xae\xa8|" ++"\xe1\x8f\x99|||\xea\xae\xa9|" ++"\xe1\x8f\x9a|||\xea\xae\xaa|" ++"\xe1\x8f\x9b|||\xea\xae\xab|" ++"\xe1\x8f\x9c|||\xea\xae\xac|" ++"\xe1\x8f\x9d|||\xea\xae\xad|" ++"\xe1\x8f\x9e|||\xea\xae\xae|" ++"\xe1\x8f\x9f|||\xea\xae\xaf|" ++"\xe1\x8f\xa0|||\xea\xae\xb0|" ++"\xe1\x8f\xa1|||\xea\xae\xb1|" ++"\xe1\x8f\xa2|||\xea\xae\xb2|" ++"\xe1\x8f\xa3|||\xea\xae\xb3|" ++"\xe1\x8f\xa4|||\xea\xae\xb4|" ++"\xe1\x8f\xa5|||\xea\xae\xb5|" ++"\xe1\x8f\xa6|||\xea\xae\xb6|" ++"\xe1\x8f\xa7|||\xea\xae\xb7|" ++"\xe1\x8f\xa8|||\xea\xae\xb8|" ++"\xe1\x8f\xa9|||\xea\xae\xb9|" ++"\xe1\x8f\xaa|||\xea\xae\xba|" ++"\xe1\x8f\xab|||\xea\xae\xbb|" ++"\xe1\x8f\xac|||\xea\xae\xbc|" ++"\xe1\x8f\xad|||\xea\xae\xbd|" ++"\xe1\x8f\xae|||\xea\xae\xbe|" ++"\xe1\x8f\xaf|||\xea\xae\xbf|" ++"\xe1\x8f\xb0|||\xe1\x8f\xb8|" ++"\xe1\x8f\xb1|||\xe1\x8f\xb9|" ++"\xe1\x8f\xb2|||\xe1\x8f\xba|" ++"\xe1\x8f\xb3|||\xe1\x8f\xbb|" ++"\xe1\x8f\xb4|||\xe1\x8f\xbc|" ++"\xe1\x8f\xb5|||\xe1\x8f\xbd|" ++"\xe1\x8f\xb8|\xe1\x8f\xb0|\xe1\x8f\xb0||" ++"\xe1\x8f\xb9|\xe1\x8f\xb1|\xe1\x8f\xb1||" ++"\xe1\x8f\xba|\xe1\x8f\xb2|\xe1\x8f\xb2||" ++"\xe1\x8f\xbb|\xe1\x8f\xb3|\xe1\x8f\xb3||" ++"\xe1\x8f\xbc|\xe1\x8f\xb4|\xe1\x8f\xb4||" ++"\xe1\x8f\xbd|\xe1\x8f\xb5|\xe1\x8f\xb5||" ++"\xe1\xb2\x80|\xd0\xb2|\xd0\x92||" ++"\xe1\xb2\x81|\xd0\xb4|\xd0\x94||" ++"\xe1\xb2\x82|\xd0\xbe|\xd0\x9e||" ++"\xe1\xb2\x83|\xd1\x81|\xd0\xa1||" ++"\xe1\xb2\x84|\xd1\x82|\xd0\xa2||" ++"\xe1\xb2\x85|\xd1\x82|\xd0\xa2||" ++"\xe1\xb2\x86|\xd1\x8a|\xd0\xaa||" ++"\xe1\xb2\x87|\xd1\xa3|\xd1\xa2||" ++"\xe1\xb2\x88|\xea\x99\x8b|\xea\x99\x8a||" + "\xe1\xba\x96|h\xcc\xb1|H\xcc\xb1||" + "\xe1\xba\x97|t\xcc\x88|T\xcc\x88||" + "\xe1\xba\x98|w\xcc\x8a|W\xcc\x8a||" +@@ -349,6 +465,86 @@ + "\xe2\x84\xa6|\xcf\x89||\xcf\x89|" + "\xe2\x84\xaa|k||k|" + "\xe2\x84\xab|\xc3\xa5||\xc3\xa5|" ++"\xea\xad\xb0|\xe1\x8e\xa0|\xe1\x8e\xa0||" ++"\xea\xad\xb1|\xe1\x8e\xa1|\xe1\x8e\xa1||" ++"\xea\xad\xb2|\xe1\x8e\xa2|\xe1\x8e\xa2||" ++"\xea\xad\xb3|\xe1\x8e\xa3|\xe1\x8e\xa3||" ++"\xea\xad\xb4|\xe1\x8e\xa4|\xe1\x8e\xa4||" ++"\xea\xad\xb5|\xe1\x8e\xa5|\xe1\x8e\xa5||" ++"\xea\xad\xb6|\xe1\x8e\xa6|\xe1\x8e\xa6||" ++"\xea\xad\xb7|\xe1\x8e\xa7|\xe1\x8e\xa7||" ++"\xea\xad\xb8|\xe1\x8e\xa8|\xe1\x8e\xa8||" ++"\xea\xad\xb9|\xe1\x8e\xa9|\xe1\x8e\xa9||" ++"\xea\xad\xba|\xe1\x8e\xaa|\xe1\x8e\xaa||" ++"\xea\xad\xbb|\xe1\x8e\xab|\xe1\x8e\xab||" ++"\xea\xad\xbc|\xe1\x8e\xac|\xe1\x8e\xac||" ++"\xea\xad\xbd|\xe1\x8e\xad|\xe1\x8e\xad||" ++"\xea\xad\xbe|\xe1\x8e\xae|\xe1\x8e\xae||" ++"\xea\xad\xbf|\xe1\x8e\xaf|\xe1\x8e\xaf||" ++"\xea\xae\x80|\xe1\x8e\xb0|\xe1\x8e\xb0||" ++"\xea\xae\x81|\xe1\x8e\xb1|\xe1\x8e\xb1||" ++"\xea\xae\x82|\xe1\x8e\xb2|\xe1\x8e\xb2||" ++"\xea\xae\x83|\xe1\x8e\xb3|\xe1\x8e\xb3||" ++"\xea\xae\x84|\xe1\x8e\xb4|\xe1\x8e\xb4||" ++"\xea\xae\x85|\xe1\x8e\xb5|\xe1\x8e\xb5||" ++"\xea\xae\x86|\xe1\x8e\xb6|\xe1\x8e\xb6||" ++"\xea\xae\x87|\xe1\x8e\xb7|\xe1\x8e\xb7||" ++"\xea\xae\x88|\xe1\x8e\xb8|\xe1\x8e\xb8||" ++"\xea\xae\x89|\xe1\x8e\xb9|\xe1\x8e\xb9||" ++"\xea\xae\x8a|\xe1\x8e\xba|\xe1\x8e\xba||" ++"\xea\xae\x8b|\xe1\x8e\xbb|\xe1\x8e\xbb||" ++"\xea\xae\x8c|\xe1\x8e\xbc|\xe1\x8e\xbc||" ++"\xea\xae\x8d|\xe1\x8e\xbd|\xe1\x8e\xbd||" ++"\xea\xae\x8e|\xe1\x8e\xbe|\xe1\x8e\xbe||" ++"\xea\xae\x8f|\xe1\x8e\xbf|\xe1\x8e\xbf||" ++"\xea\xae\x90|\xe1\x8f\x80|\xe1\x8f\x80||" ++"\xea\xae\x91|\xe1\x8f\x81|\xe1\x8f\x81||" ++"\xea\xae\x92|\xe1\x8f\x82|\xe1\x8f\x82||" ++"\xea\xae\x93|\xe1\x8f\x83|\xe1\x8f\x83||" ++"\xea\xae\x94|\xe1\x8f\x84|\xe1\x8f\x84||" ++"\xea\xae\x95|\xe1\x8f\x85|\xe1\x8f\x85||" ++"\xea\xae\x96|\xe1\x8f\x86|\xe1\x8f\x86||" ++"\xea\xae\x97|\xe1\x8f\x87|\xe1\x8f\x87||" ++"\xea\xae\x98|\xe1\x8f\x88|\xe1\x8f\x88||" ++"\xea\xae\x99|\xe1\x8f\x89|\xe1\x8f\x89||" ++"\xea\xae\x9a|\xe1\x8f\x8a|\xe1\x8f\x8a||" ++"\xea\xae\x9b|\xe1\x8f\x8b|\xe1\x8f\x8b||" ++"\xea\xae\x9c|\xe1\x8f\x8c|\xe1\x8f\x8c||" ++"\xea\xae\x9d|\xe1\x8f\x8d|\xe1\x8f\x8d||" ++"\xea\xae\x9e|\xe1\x8f\x8e|\xe1\x8f\x8e||" ++"\xea\xae\x9f|\xe1\x8f\x8f|\xe1\x8f\x8f||" ++"\xea\xae\xa0|\xe1\x8f\x90|\xe1\x8f\x90||" ++"\xea\xae\xa1|\xe1\x8f\x91|\xe1\x8f\x91||" ++"\xea\xae\xa2|\xe1\x8f\x92|\xe1\x8f\x92||" ++"\xea\xae\xa3|\xe1\x8f\x93|\xe1\x8f\x93||" ++"\xea\xae\xa4|\xe1\x8f\x94|\xe1\x8f\x94||" ++"\xea\xae\xa5|\xe1\x8f\x95|\xe1\x8f\x95||" ++"\xea\xae\xa6|\xe1\x8f\x96|\xe1\x8f\x96||" ++"\xea\xae\xa7|\xe1\x8f\x97|\xe1\x8f\x97||" ++"\xea\xae\xa8|\xe1\x8f\x98|\xe1\x8f\x98||" ++"\xea\xae\xa9|\xe1\x8f\x99|\xe1\x8f\x99||" ++"\xea\xae\xaa|\xe1\x8f\x9a|\xe1\x8f\x9a||" ++"\xea\xae\xab|\xe1\x8f\x9b|\xe1\x8f\x9b||" ++"\xea\xae\xac|\xe1\x8f\x9c|\xe1\x8f\x9c||" ++"\xea\xae\xad|\xe1\x8f\x9d|\xe1\x8f\x9d||" ++"\xea\xae\xae|\xe1\x8f\x9e|\xe1\x8f\x9e||" ++"\xea\xae\xaf|\xe1\x8f\x9f|\xe1\x8f\x9f||" ++"\xea\xae\xb0|\xe1\x8f\xa0|\xe1\x8f\xa0||" ++"\xea\xae\xb1|\xe1\x8f\xa1|\xe1\x8f\xa1||" ++"\xea\xae\xb2|\xe1\x8f\xa2|\xe1\x8f\xa2||" ++"\xea\xae\xb3|\xe1\x8f\xa3|\xe1\x8f\xa3||" ++"\xea\xae\xb4|\xe1\x8f\xa4|\xe1\x8f\xa4||" ++"\xea\xae\xb5|\xe1\x8f\xa5|\xe1\x8f\xa5||" ++"\xea\xae\xb6|\xe1\x8f\xa6|\xe1\x8f\xa6||" ++"\xea\xae\xb7|\xe1\x8f\xa7|\xe1\x8f\xa7||" ++"\xea\xae\xb8|\xe1\x8f\xa8|\xe1\x8f\xa8||" ++"\xea\xae\xb9|\xe1\x8f\xa9|\xe1\x8f\xa9||" ++"\xea\xae\xba|\xe1\x8f\xaa|\xe1\x8f\xaa||" ++"\xea\xae\xbb|\xe1\x8f\xab|\xe1\x8f\xab||" ++"\xea\xae\xbc|\xe1\x8f\xac|\xe1\x8f\xac||" ++"\xea\xae\xbd|\xe1\x8f\xad|\xe1\x8f\xad||" ++"\xea\xae\xbe|\xe1\x8f\xae|\xe1\x8f\xae||" ++"\xea\xae\xbf|\xe1\x8f\xaf|\xe1\x8f\xaf||" + "\xef\xac\x80|ff|FF||" + "\xef\xac\x81|fi|FI||" + "\xef\xac\x82|fl|FL||" diff --git a/src/scintilla_backports/6153_a0f26eaf474d.patch b/src/scintilla_backports/6153_a0f26eaf474d.patch new file mode 100644 index 00000000..34c90ce7 --- /dev/null +++ b/src/scintilla_backports/6153_a0f26eaf474d.patch @@ -0,0 +1,7832 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1490944778 -39600 +# Node ID a0f26eaf474d98cb999629f79a3d082c0028925b +# Parent 1788f6795302a077e98c9cea25100068eef8624b +Using Sci::Position and Sci::Line to mark variables that are document positions +and lines. + +diff -r 1788f6795302 -r a0f26eaf474d cocoa/ScintillaCocoa.h +--- a/cocoa/ScintillaCocoa.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/cocoa/ScintillaCocoa.h Fri Mar 31 18:19:38 2017 +1100 +@@ -158,10 +158,10 @@ + void SetMouseCapture(bool on) override; + bool HaveMouseCapture() override; + void WillDraw(NSRect rect); +- void ScrollText(int linesToMove) override; ++ void ScrollText(Sci::Line linesToMove) override; + void SetVerticalScrollPos() override; + void SetHorizontalScrollPos() override; +- bool ModifyScrollBars(int nMax, int nPage) override; ++ bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) override; + bool SetScrollingSize(void); + void Resize(); + void UpdateForScroll(); +@@ -197,7 +197,7 @@ + void ObserverAdd(); + void ObserverRemove(); + void IdleWork() override; +- void QueueIdleWork(WorkNeeded::workItems items, int upTo) override; ++ void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) override; + int InsertText(NSString* input); + NSRange PositionsFromCharacters(NSRange rangeCharacters) const; + NSRange CharactersFromPositions(NSRange rangePositions) const; +diff -r 1788f6795302 -r a0f26eaf474d cocoa/ScintillaCocoa.mm +--- a/cocoa/ScintillaCocoa.mm Thu Mar 30 09:11:48 2017 +1100 ++++ b/cocoa/ScintillaCocoa.mm Fri Mar 31 18:19:38 2017 +1100 +@@ -522,7 +522,7 @@ + + //-------------------------------------------------------------------------------------------------- + +-void ScintillaCocoa::QueueIdleWork(WorkNeeded::workItems items, int upTo) { ++void ScintillaCocoa::QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) { + Editor::QueueIdleWork(items, upTo); + ObserverAdd(); + } +@@ -1236,7 +1236,7 @@ + */ + NSPoint ScintillaCocoa::GetCaretPosition() + { +- const int line = pdoc->LineFromPosition(sel.RangeMain().caret.Position()); ++ const Sci::Line line = pdoc->LineFromPosition(sel.RangeMain().caret.Position()); + NSPoint result; + + result.y = line; +@@ -1261,9 +1261,9 @@ + } + + // TODO: does not work for wrapped lines, fix it. +- int line = pdoc->LineFromPosition(posDrag.Position()); +- int currentVisibleLine = cs.DisplayFromDoc(line); +- int lastVisibleLine = Platform::Minimum(topLine + LinesOnScreen(), cs.LinesDisplayed()) - 2; ++ Sci::Line line = pdoc->LineFromPosition(posDrag.Position()); ++ Sci::Line currentVisibleLine = cs.DisplayFromDoc(line); ++ Sci::Line lastVisibleLine = Platform::Minimum(topLine + LinesOnScreen(), cs.LinesDisplayed()) - 2; + + if (currentVisibleLine <= topLine && topLine > 0) + ScrollTo(topLine - scrollSpeed); +@@ -1368,10 +1368,10 @@ + + // calculate the bounds of the selection + PRectangle client = GetTextRectangle(); +- int selStart = sel.RangeMain().Start().Position(); +- int selEnd = sel.RangeMain().End().Position(); +- int startLine = pdoc->LineFromPosition(selStart); +- int endLine = pdoc->LineFromPosition(selEnd); ++ Sci::Position selStart = sel.RangeMain().Start().Position(); ++ Sci::Position selEnd = sel.RangeMain().End().Position(); ++ Sci::Line startLine = pdoc->LineFromPosition(selStart); ++ Sci::Line endLine = pdoc->LineFromPosition(selEnd); + Point pt; + long startPos, endPos, ep; + PRectangle rcSel; +@@ -1561,7 +1561,7 @@ + void ScintillaCocoa::DraggingExited(id <NSDraggingInfo> info) + { + #pragma unused(info) +- SetDragPosition(SelectionPosition(invalidPosition)); ++ SetDragPosition(SelectionPosition(Sci::invalidPosition)); + FineTickerCancel(tickPlatform); + inDragDrop = ddNone; + } +@@ -1914,7 +1914,7 @@ + /** + * ScrollText is empty because scrolling is handled by the NSScrollView. + */ +-void ScintillaCocoa::ScrollText(int) ++void ScintillaCocoa::ScrollText(Sci::Line) + { + } + +@@ -1968,7 +1968,7 @@ + * @param nPage Number of lines per scroll page. + * @return True if there was a change, otherwise false. + */ +-bool ScintillaCocoa::ModifyScrollBars(int nMax, int nPage) ++bool ScintillaCocoa::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) + { + #pragma unused(nMax, nPage) + return SetScrollingSize(); +diff -r 1788f6795302 -r a0f26eaf474d gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/gtk/ScintillaGTK.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -1029,7 +1029,7 @@ + return rc; + } + +-void ScintillaGTK::ScrollText(int linesToMove) { ++void ScintillaGTK::ScrollText(Sci::Line linesToMove) { + int diff = vs.lineHeight * -linesToMove; + //Platform::DebugPrintf("ScintillaGTK::ScrollText %d %d %0d,%0d %0d,%0d\n", linesToMove, diff, + // rc.left, rc.top, rc.right, rc.bottom); +@@ -1052,7 +1052,7 @@ + gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmenth), xOffset); + } + +-bool ScintillaGTK::ModifyScrollBars(int nMax, int nPage) { ++bool ScintillaGTK::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) { + bool modified = false; + int pageScroll = LinesToScroll(); + +@@ -2763,7 +2763,7 @@ + void ScintillaGTK::DragLeave(GtkWidget *widget, GdkDragContext * /*context*/, guint) { + ScintillaGTK *sciThis = FromWidget(widget); + try { +- sciThis->SetDragPosition(SelectionPosition(invalidPosition)); ++ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition)); + //Platform::DebugPrintf("DragLeave %x\n", sciThis); + } catch (...) { + sciThis->errorStatus = SC_STATUS_FAILURE; +@@ -2776,7 +2776,7 @@ + // If drag did not result in drop here or elsewhere + if (!sciThis->dragWasDropped) + sciThis->SetEmptySelection(sciThis->posDrag); +- sciThis->SetDragPosition(SelectionPosition(invalidPosition)); ++ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition)); + //Platform::DebugPrintf("DragEnd %x %d\n", sciThis, sciThis->dragWasDropped); + sciThis->inDragDrop = ddNone; + } catch (...) { +@@ -2789,7 +2789,7 @@ + ScintillaGTK *sciThis = FromWidget(widget); + try { + //Platform::DebugPrintf("Drop %x\n", sciThis); +- sciThis->SetDragPosition(SelectionPosition(invalidPosition)); ++ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition)); + } catch (...) { + sciThis->errorStatus = SC_STATUS_FAILURE; + } +@@ -2801,7 +2801,7 @@ + ScintillaGTK *sciThis = FromWidget(widget); + try { + sciThis->ReceivedDrop(selection_data); +- sciThis->SetDragPosition(SelectionPosition(invalidPosition)); ++ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition)); + } catch (...) { + sciThis->errorStatus = SC_STATUS_FAILURE; + } +@@ -2832,7 +2832,7 @@ + } + sciThis->ClearSelection(); + } +- sciThis->SetDragPosition(SelectionPosition(invalidPosition)); ++ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition)); + } catch (...) { + sciThis->errorStatus = SC_STATUS_FAILURE; + } +@@ -2870,7 +2870,7 @@ + styleIdleID = 0; + } + +-void ScintillaGTK::QueueIdleWork(WorkNeeded::workItems items, int upTo) { ++void ScintillaGTK::QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) { + Editor::QueueIdleWork(items, upTo); + if (!styleIdleID) { + // Only allow one style needed to be queued +diff -r 1788f6795302 -r a0f26eaf474d gtk/ScintillaGTK.h +--- a/gtk/ScintillaGTK.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/gtk/ScintillaGTK.h Fri Mar 31 18:19:38 2017 +1100 +@@ -111,10 +111,10 @@ + virtual bool PaintContains(PRectangle rc); + void FullPaint(); + virtual PRectangle GetClientRectangle() const; +- virtual void ScrollText(int linesToMove); ++ virtual void ScrollText(Sci::Line linesToMove); + virtual void SetVerticalScrollPos(); + virtual void SetHorizontalScrollPos(); +- virtual bool ModifyScrollBars(int nMax, int nPage); ++ virtual bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage); + void ReconfigureScrollBars(); + virtual void NotifyChange(); + virtual void NotifyFocus(bool focus); +@@ -231,7 +231,7 @@ + static gboolean IdleCallback(gpointer pSci); + static gboolean StyleIdle(gpointer pSci); + virtual void IdleWork(); +- virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo); ++ virtual void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo); + virtual void SetDocPointer(Document *document); + static void PopUpCB(GtkMenuItem *menuItem, ScintillaGTK *sciThis); + +diff -r 1788f6795302 -r a0f26eaf474d gtk/ScintillaGTKAccessible.cxx +--- a/gtk/ScintillaGTKAccessible.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -168,7 +168,7 @@ + } + } + +-gchar *ScintillaGTKAccessible::GetTextRangeUTF8(Position startByte, Position endByte) { ++gchar *ScintillaGTKAccessible::GetTextRangeUTF8(Sci::Position startByte, Sci::Position endByte) { + g_return_val_if_fail(startByte >= 0, NULL); + // FIXME: should we swap start/end if necessary? + g_return_val_if_fail(endByte >= startByte, NULL); +@@ -196,7 +196,7 @@ + } + + gchar *ScintillaGTKAccessible::GetText(int startChar, int endChar) { +- Position startByte, endByte; ++ Sci::Position startByte, endByte; + if (endChar == -1) { + startByte = ByteOffsetFromCharacterOffset(startChar); + endByte = sci->pdoc->Length(); +@@ -210,8 +210,8 @@ + AtkTextBoundary boundaryType, int *startChar, int *endChar) { + g_return_val_if_fail(charOffset >= 0, NULL); + +- Position startByte, endByte; +- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); ++ Sci::Position startByte, endByte; ++ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); + + switch (boundaryType) { + case ATK_TEXT_BOUNDARY_CHAR: +@@ -261,8 +261,8 @@ + AtkTextBoundary boundaryType, int *startChar, int *endChar) { + g_return_val_if_fail(charOffset >= 0, NULL); + +- Position startByte, endByte; +- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); ++ Sci::Position startByte, endByte; ++ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); + + switch (boundaryType) { + case ATK_TEXT_BOUNDARY_CHAR: +@@ -323,8 +323,8 @@ + AtkTextBoundary boundaryType, int *startChar, int *endChar) { + g_return_val_if_fail(charOffset >= 0, NULL); + +- Position startByte, endByte; +- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); ++ Sci::Position startByte, endByte; ++ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); + + switch (boundaryType) { + case ATK_TEXT_BOUNDARY_CHAR: +@@ -386,8 +386,8 @@ + AtkTextGranularity granularity, int *startChar, int *endChar) { + g_return_val_if_fail(charOffset >= 0, NULL); + +- Position startByte, endByte; +- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); ++ Sci::Position startByte, endByte; ++ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); + + switch (granularity) { + case ATK_TEXT_GRANULARITY_CHAR: +@@ -417,8 +417,8 @@ + gunichar ScintillaGTKAccessible::GetCharacterAtOffset(int charOffset) { + g_return_val_if_fail(charOffset >= 0, 0); + +- Position startByte = ByteOffsetFromCharacterOffset(charOffset); +- Position endByte = PositionAfter(startByte); ++ Sci::Position startByte = ByteOffsetFromCharacterOffset(charOffset); ++ Sci::Position endByte = PositionAfter(startByte); + gchar *ch = GetTextRangeUTF8(startByte, endByte); + gunichar unichar = g_utf8_get_char_validated(ch, -1); + g_free(ch); +@@ -466,7 +466,7 @@ + gint *x, gint *y, gint *width, gint *height, AtkCoordType coords) { + *x = *y = *height = *width = 0; + +- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); ++ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset); + + // FIXME: should we handle scrolling? + *x = sci->WndProc(SCI_POINTXFROMPOSITION, 0, byteOffset); +@@ -550,7 +550,7 @@ + AtkAttributeSet *ScintillaGTKAccessible::GetRunAttributes(int charOffset, int *startChar, int *endChar) { + g_return_val_if_fail(charOffset >= -1, NULL); + +- Position byteOffset; ++ Sci::Position byteOffset; + if (charOffset == -1) { + byteOffset = sci->WndProc(SCI_GETCURRENTPOS, 0, 0); + } else { +@@ -562,11 +562,11 @@ + + const char style = StyleAt(byteOffset, true); + // compute the range for this style +- Position startByte = byteOffset; ++ Sci::Position startByte = byteOffset; + // when going backwards, we know the style is already computed + while (startByte > 0 && sci->pdoc->StyleAt((startByte) - 1) == style) + (startByte)--; +- Position endByte = byteOffset + 1; ++ Sci::Position endByte = byteOffset + 1; + while (endByte < length && StyleAt(endByte, true) == style) + (endByte)++; + +@@ -586,8 +586,8 @@ + if (selection_num < 0 || (unsigned int) selection_num >= sci->sel.Count()) + return NULL; + +- Position startByte = sci->sel.Range(selection_num).Start().Position(); +- Position endByte = sci->sel.Range(selection_num).End().Position(); ++ Sci::Position startByte = sci->sel.Range(selection_num).Start().Position(); ++ Sci::Position endByte = sci->sel.Range(selection_num).End().Position(); + + CharacterRangeFromByteRange(startByte, endByte, startChar, endChar); + return GetTextRangeUTF8(startByte, endByte); +@@ -595,7 +595,7 @@ + + gboolean ScintillaGTKAccessible::AddSelection(int startChar, int endChar) { + size_t n_selections = sci->sel.Count(); +- Position startByte, endByte; ++ Sci::Position startByte, endByte; + ByteRangeFromCharacterRange(startChar, endChar, startByte, endByte); + // use WndProc() to set the selections so it notifies as needed + if (n_selections > 1 || ! sci->sel.Empty()) { +@@ -627,7 +627,7 @@ + if (selection_num < 0 || (unsigned int) selection_num >= sci->sel.Count()) + return FALSE; + +- Position startByte, endByte; ++ Sci::Position startByte, endByte; + ByteRangeFromCharacterRange(startChar, endChar, startByte, endByte); + + sci->WndProc(SCI_SETSELECTIONNSTART, selection_num, startByte); +@@ -668,7 +668,7 @@ + } + } + +-bool ScintillaGTKAccessible::InsertStringUTF8(Position bytePos, const gchar *utf8, int lengthBytes) { ++bool ScintillaGTKAccessible::InsertStringUTF8(Sci::Position bytePos, const gchar *utf8, Sci::Position lengthBytes) { + if (sci->pdoc->IsReadOnly()) { + return false; + } +@@ -688,7 +688,7 @@ + } + + void ScintillaGTKAccessible::InsertText(const gchar *text, int lengthBytes, int *charPosition) { +- Position bytePosition = ByteOffsetFromCharacterOffset(*charPosition); ++ Sci::Position bytePosition = ByteOffsetFromCharacterOffset(*charPosition); + + // FIXME: should we update the target? + if (InsertStringUTF8(bytePosition, text, lengthBytes)) { +@@ -697,7 +697,7 @@ + } + + void ScintillaGTKAccessible::CopyText(int startChar, int endChar) { +- Position startByte, endByte; ++ Sci::Position startByte, endByte; + ByteRangeFromCharacterRange(startChar, endChar, startByte, endByte); + sci->CopyRangeToClipboard(startByte, endByte); + } +@@ -716,7 +716,7 @@ + g_return_if_fail(endChar >= startChar); + + if (! sci->pdoc->IsReadOnly()) { +- Position startByte, endByte; ++ Sci::Position startByte, endByte; + ByteRangeFromCharacterRange(startChar, endChar, startByte, endByte); + + if (! sci->RangeContainsProtected(startByte, endByte)) { +@@ -735,13 +735,13 @@ + // has always done that without problems, so let's guess it's a fairly safe bet. + struct Helper : GObjectWatcher { + ScintillaGTKAccessible *scia; +- Position bytePosition; ++ Sci::Position bytePosition; + + virtual void Destroyed() { + scia = 0; + } + +- Helper(ScintillaGTKAccessible *scia_, Position bytePos_) : ++ Helper(ScintillaGTKAccessible *scia_, Sci::Position bytePos_) : + GObjectWatcher(G_OBJECT(scia_->sci->sci)), + scia(scia_), + bytePosition(bytePos_) { +@@ -757,7 +757,7 @@ + len = convertedText.length(); + text = convertedText.c_str(); + } +- scia->InsertStringUTF8(bytePosition, text, static_cast<int>(len)); ++ scia->InsertStringUTF8(bytePosition, text, static_cast<Sci::Position>(len)); + } + } + +@@ -795,7 +795,7 @@ + // Callbacks + + void ScintillaGTKAccessible::UpdateCursor() { +- Position pos = sci->WndProc(SCI_GETCURRENTPOS, 0, 0); ++ Sci::Position pos = sci->WndProc(SCI_GETCURRENTPOS, 0, 0); + if (old_pos != pos) { + int charPosition = CharacterOffsetFromByteOffset(pos); + g_signal_emit_by_name(accessible, "text-caret-moved", charPosition); +@@ -875,7 +875,7 @@ + case SCN_MODIFIED: { + if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { + // invalidate character offset cache if applicable +- const Position line = sci->pdoc->LineFromPosition(nt->position); ++ const Sci::Line line = sci->pdoc->LineFromPosition(nt->position); + if (character_offsets.size() > static_cast<size_t>(line + 1)) { + character_offsets.resize(line + 1); + } +diff -r 1788f6795302 -r a0f26eaf474d gtk/ScintillaGTKAccessible.h +--- a/gtk/ScintillaGTKAccessible.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.h Fri Mar 31 18:19:38 2017 +1100 +@@ -21,12 +21,12 @@ + ScintillaGTK *sci; + + // cache holding character offset for each line start, see CharacterOffsetFromByteOffset() +- std::vector<Position> character_offsets; ++ std::vector<Sci::Position> character_offsets; + + // cached length of the deletion, in characters (see Notify()) + int deletionLengthChar; + // local state for comparing +- Position old_pos; ++ Sci::Position old_pos; + std::vector<SelectionRange> old_sels; + + bool Enabled() const; +@@ -38,8 +38,8 @@ + } catch (...) {} + } + +- Position ByteOffsetFromCharacterOffset(Position startByte, int characterOffset) { +- Position pos = sci->pdoc->GetRelativePosition(startByte, characterOffset); ++ Sci::Position ByteOffsetFromCharacterOffset(Sci::Position startByte, int characterOffset) { ++ Sci::Position pos = sci->pdoc->GetRelativePosition(startByte, characterOffset); + if (pos == INVALID_POSITION) { + // clamp invalid positions inside the document + if (characterOffset > 0) { +@@ -51,51 +51,51 @@ + return pos; + } + +- Position ByteOffsetFromCharacterOffset(int characterOffset) { ++ Sci::Position ByteOffsetFromCharacterOffset(Sci::Position characterOffset) { + return ByteOffsetFromCharacterOffset(0, characterOffset); + } + +- int CharacterOffsetFromByteOffset(Position byteOffset) { +- const Position line = sci->pdoc->LineFromPosition(byteOffset); ++ Sci::Position CharacterOffsetFromByteOffset(Sci::Position byteOffset) { ++ const Sci::Line line = sci->pdoc->LineFromPosition(byteOffset); + if (character_offsets.size() <= static_cast<size_t>(line)) { + if (character_offsets.empty()) + character_offsets.push_back(0); +- for (Position i = character_offsets.size(); i <= line; i++) { +- const Position start = sci->pdoc->LineStart(i - 1); +- const Position end = sci->pdoc->LineStart(i); ++ for (Sci::Position i = character_offsets.size(); i <= line; i++) { ++ const Sci::Position start = sci->pdoc->LineStart(i - 1); ++ const Sci::Position end = sci->pdoc->LineStart(i); + character_offsets.push_back(character_offsets[i - 1] + sci->pdoc->CountCharacters(start, end)); + } + } +- const Position lineStart = sci->pdoc->LineStart(line); ++ const Sci::Position lineStart = sci->pdoc->LineStart(line); + return character_offsets[line] + sci->pdoc->CountCharacters(lineStart, byteOffset); + } + +- void CharacterRangeFromByteRange(Position startByte, Position endByte, int *startChar, int *endChar) { ++ void CharacterRangeFromByteRange(Sci::Position startByte, Sci::Position endByte, int *startChar, int *endChar) { + *startChar = CharacterOffsetFromByteOffset(startByte); + *endChar = *startChar + sci->pdoc->CountCharacters(startByte, endByte); + } + +- void ByteRangeFromCharacterRange(int startChar, int endChar, Position& startByte, Position& endByte) { ++ void ByteRangeFromCharacterRange(int startChar, int endChar, Sci::Position& startByte, Sci::Position& endByte) { + startByte = ByteOffsetFromCharacterOffset(startChar); + endByte = ByteOffsetFromCharacterOffset(startByte, endChar - startChar); + } + +- Position PositionBefore(Position pos) { ++ Sci::Position PositionBefore(Sci::Position pos) { + return sci->pdoc->MovePositionOutsideChar(pos - 1, -1, true); + } + +- Position PositionAfter(Position pos) { ++ Sci::Position PositionAfter(Sci::Position pos) { + return sci->pdoc->MovePositionOutsideChar(pos + 1, 1, true); + } + +- int StyleAt(Position position, bool ensureStyle = false) { ++ int StyleAt(Sci::Position position, bool ensureStyle = false) { + if (ensureStyle) + sci->pdoc->EnsureStyledTo(position); + return sci->pdoc->StyleAt(position); + } + + // For AtkText +- gchar *GetTextRangeUTF8(Position startByte, Position endByte); ++ gchar *GetTextRangeUTF8(Sci::Position startByte, Sci::Position endByte); + gchar *GetText(int startChar, int endChar); + gchar *GetTextAfterOffset(int charOffset, AtkTextBoundary boundaryType, int *startChar, int *endChar); + gchar *GetTextBeforeOffset(int charOffset, AtkTextBoundary boundaryType, int *startChar, int *endChar); +@@ -118,7 +118,7 @@ + gboolean RemoveSelection(int selection_num); + gboolean SetSelection(gint selection_num, int startChar, int endChar); + // for AtkEditableText +- bool InsertStringUTF8(Position bytePos, const gchar *utf8, int lengthBytes); ++ bool InsertStringUTF8(Sci::Position bytePos, const gchar *utf8, Sci::Position lengthBytes); + void SetTextContents(const gchar *contents); + void InsertText(const gchar *contents, int lengthBytes, int *charPosition); + void CopyText(int startChar, int endChar); +diff -r 1788f6795302 -r a0f26eaf474d qt/ScintillaEdit/ScintillaDocument.cpp +--- a/qt/ScintillaEdit/ScintillaDocument.cpp Thu Mar 30 09:11:48 2017 +1100 ++++ b/qt/ScintillaEdit/ScintillaDocument.cpp Fri Mar 31 18:19:38 2017 +1100 +@@ -45,7 +45,7 @@ + void NotifySavePoint(Document *doc, void *userData, bool atSavePoint); + void NotifyModified(Document *doc, DocModification mh, void *userData); + void NotifyDeleted(Document *doc, void *userData); +- void NotifyStyleNeeded(Document *doc, void *userData, int endPos); ++ void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos); + void NotifyLexerChanged(Document *doc, void *userData); + void NotifyErrorOccurred(Document *doc, void *userData, int status); + }; +@@ -76,7 +76,7 @@ + void WatcherHelper::NotifyDeleted(Document *, void *) { + } + +-void WatcherHelper::NotifyStyleNeeded(Document *, void *, int endPos) { ++void WatcherHelper::NotifyStyleNeeded(Document *, void *, Sci::Position endPos) { + owner->emit_style_needed(endPos); + } + +diff -r 1788f6795302 -r a0f26eaf474d qt/ScintillaEditBase/ScintillaQt.cpp +--- a/qt/ScintillaEditBase/ScintillaQt.cpp Thu Mar 30 09:11:48 2017 +1100 ++++ b/qt/ScintillaEditBase/ScintillaQt.cpp Fri Mar 31 18:19:38 2017 +1100 +@@ -239,7 +239,7 @@ + } + + +-void ScintillaQt::ScrollText(int linesToMove) ++void ScintillaQt::ScrollText(Sci::Line linesToMove) + { + int dy = vs.lineHeight * (linesToMove); + scrollArea->viewport()->scroll(0, dy); +@@ -257,7 +257,7 @@ + emit horizontalScrolled(xOffset); + } + +-bool ScintillaQt::ModifyScrollBars(int nMax, int nPage) ++bool ScintillaQt::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) + { + bool modified = false; + +@@ -613,7 +613,7 @@ + } + } + inDragDrop = ddNone; +- SetDragPosition(SelectionPosition(invalidPosition)); ++ SetDragPosition(SelectionPosition(Sci::invalidPosition)); + } + + void ScintillaQt::CreateCallTipWindow(PRectangle rc) +@@ -740,7 +740,7 @@ + + void ScintillaQt::DragLeave() + { +- SetDragPosition(SelectionPosition(invalidPosition)); ++ SetDragPosition(SelectionPosition(Sci::invalidPosition)); + } + + void ScintillaQt::Drop(const Point &point, const QMimeData *data, bool move) +diff -r 1788f6795302 -r a0f26eaf474d qt/ScintillaEditBase/ScintillaQt.h +--- a/qt/ScintillaEditBase/ScintillaQt.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/qt/ScintillaEditBase/ScintillaQt.h Fri Mar 31 18:19:38 2017 +1100 +@@ -107,7 +107,7 @@ + virtual void ScrollText(int linesToMove); + virtual void SetVerticalScrollPos(); + virtual void SetHorizontalScrollPos(); +- virtual bool ModifyScrollBars(int nMax, int nPage); ++ virtual bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage); + virtual void ReconfigureScrollBars(); + void CopyToModeClipboard(const SelectionText &selectedText, QClipboard::Mode clipboardMode_); + virtual void Copy(); +diff -r 1788f6795302 -r a0f26eaf474d src/AutoComplete.cxx +--- a/src/AutoComplete.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/AutoComplete.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -58,7 +58,7 @@ + } + + void AutoComplete::Start(Window &parent, int ctrlID, +- int position, Point location, int startLen_, ++ Sci::Position position, Point location, int startLen_, + int lineHeight, bool unicodeMode, int technology) { + if (active) { + Cancel(); +diff -r 1788f6795302 -r a0f26eaf474d src/AutoComplete.h +--- a/src/AutoComplete.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/AutoComplete.h Fri Mar 31 18:19:38 2017 +1100 +@@ -28,7 +28,7 @@ + bool ignoreCase; + bool chooseSingle; + ListBox *lb; +- int posStart; ++ Sci::Position posStart; + int startLen; + /// Should autocompletion be canceled if editor's currentPos <= startPos? + bool cancelAtStartPos; +@@ -50,7 +50,7 @@ + bool Active() const; + + /// Display the auto completion list positioned to be near a character position +- void Start(Window &parent, int ctrlID, int position, Point location, ++ void Start(Window &parent, int ctrlID, Sci::Position position, Point location, + int startLen_, int lineHeight, bool unicodeMode, int technology); + + /// The stop chars are characters which, when typed, cause the auto completion list to disappear +diff -r 1788f6795302 -r a0f26eaf474d src/CallTip.cxx +--- a/src/CallTip.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/CallTip.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -250,7 +250,7 @@ + clickPlace = 2; + } + +-PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *defn, ++PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn, + const char *faceName, int size, + int codePage_, int characterSet, + int technology, Window &wParent) { +diff -r 1788f6795302 -r a0f26eaf474d src/CallTip.h +--- a/src/CallTip.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/CallTip.h Fri Mar 31 18:19:38 2017 +1100 +@@ -41,7 +41,7 @@ + Window wCallTip; + Window wDraw; + bool inCallTipMode; +- int posStartCallTip; ++ Sci::Position posStartCallTip; + ColourDesired colourBG; + ColourDesired colourUnSel; + ColourDesired colourSel; +@@ -63,7 +63,7 @@ + void MouseClick(Point pt); + + /// Setup the calltip and return a rectangle of the area required. +- PRectangle CallTipStart(int pos, Point pt, int textHeight, const char *defn, ++ PRectangle CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn, + const char *faceName, int size, int codePage_, + int characterSet, int technology, Window &wParent); + +diff -r 1788f6795302 -r a0f26eaf474d src/CellBuffer.cxx +--- a/src/CellBuffer.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/CellBuffer.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -45,11 +45,11 @@ + perLine = pl; + } + +-void LineVector::InsertText(int line, int delta) { ++void LineVector::InsertText(Sci::Line line, Sci::Position delta) { + starts.InsertText(line, delta); + } + +-void LineVector::InsertLine(int line, int position, bool lineStart) { ++void LineVector::InsertLine(Sci::Line line, Sci::Position position, bool lineStart) { + starts.InsertPartition(line, position); + if (perLine) { + if ((line > 0) && lineStart) +@@ -58,18 +58,18 @@ + } + } + +-void LineVector::SetLineStart(int line, int position) { ++void LineVector::SetLineStart(Sci::Line line, Sci::Position position) { + starts.SetPartitionStartPosition(line, position); + } + +-void LineVector::RemoveLine(int line) { ++void LineVector::RemoveLine(Sci::Line line) { + starts.RemovePartition(line); + if (perLine) { + perLine->RemoveLine(line); + } + } + +-int LineVector::LineFromPosition(int pos) const { ++Sci::Line LineVector::LineFromPosition(Sci::Position pos) const { + return starts.PartitionFromPosition(pos); + } + +@@ -85,7 +85,7 @@ + Destroy(); + } + +-void Action::Create(actionType at_, int position_, const char *data_, int lenData_, bool mayCoalesce_) { ++void Action::Create(actionType at_, Sci::Position position_, const char *data_, Sci::Position lenData_, bool mayCoalesce_) { + delete []data; + data = NULL; + position = position_; +@@ -171,7 +171,7 @@ + } + } + +-const char *UndoHistory::AppendAction(actionType at, int position, const char *data, int lengthData, ++const char *UndoHistory::AppendAction(actionType at, Sci::Position position, const char *data, Sci::Position lengthData, + bool &startSequence, bool mayCoalesce) { + EnsureUndoRoom(); + //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); +@@ -375,11 +375,11 @@ + CellBuffer::~CellBuffer() { + } + +-char CellBuffer::CharAt(int position) const { ++char CellBuffer::CharAt(Sci::Position position) const { + return substance.ValueAt(position); + } + +-void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) const { ++void CellBuffer::GetCharRange(char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const { + if (lengthRetrieve <= 0) + return; + if (position < 0) +@@ -392,11 +392,11 @@ + substance.GetRange(buffer, position, lengthRetrieve); + } + +-char CellBuffer::StyleAt(int position) const { ++char CellBuffer::StyleAt(Sci::Position position) const { + return style.ValueAt(position); + } + +-void CellBuffer::GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const { ++void CellBuffer::GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const { + if (lengthRetrieve < 0) + return; + if (position < 0) +@@ -413,16 +413,16 @@ + return substance.BufferPointer(); + } + +-const char *CellBuffer::RangePointer(int position, int rangeLength) { ++const char *CellBuffer::RangePointer(Sci::Position position, Sci::Position rangeLength) { + return substance.RangePointer(position, rangeLength); + } + +-int CellBuffer::GapPosition() const { ++Sci::Position CellBuffer::GapPosition() const { + return substance.GapPosition(); + } + + // The char* returned is to an allocation owned by the undo history +-const char *CellBuffer::InsertString(int position, const char *s, int insertLength, bool &startSequence) { ++const char *CellBuffer::InsertString(Sci::Position position, const char *s, Sci::Position insertLength, bool &startSequence) { + // InsertString and DeleteChars are the bottleneck though which all changes occur + const char *data = s; + if (!readOnly) { +@@ -437,7 +437,7 @@ + return data; + } + +-bool CellBuffer::SetStyleAt(int position, char styleValue) { ++bool CellBuffer::SetStyleAt(Sci::Position position, char styleValue) { + char curVal = style.ValueAt(position); + if (curVal != styleValue) { + style.SetValueAt(position, styleValue); +@@ -447,7 +447,7 @@ + } + } + +-bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue) { ++bool CellBuffer::SetStyleFor(Sci::Position position, Sci::Position lengthStyle, char styleValue) { + bool changed = false; + PLATFORM_ASSERT(lengthStyle == 0 || + (lengthStyle > 0 && lengthStyle + position <= style.Length())); +@@ -463,7 +463,7 @@ + } + + // The char* returned is to an allocation owned by the undo history +-const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startSequence) { ++const char *CellBuffer::DeleteChars(Sci::Position position, Sci::Position deleteLength, bool &startSequence) { + // InsertString and DeleteChars are the bottleneck though which all changes occur + PLATFORM_ASSERT(deleteLength > 0); + const char *data = 0; +@@ -480,11 +480,11 @@ + return data; + } + +-int CellBuffer::Length() const { ++Sci::Position CellBuffer::Length() const { + return substance.Length(); + } + +-void CellBuffer::Allocate(int newSize) { ++void CellBuffer::Allocate(Sci::Position newSize) { + substance.ReAllocate(newSize); + style.ReAllocate(newSize); + } +@@ -496,10 +496,10 @@ + } + } + +-bool CellBuffer::ContainsLineEnd(const char *s, int length) const { ++bool CellBuffer::ContainsLineEnd(const char *s, Sci::Position length) const { + unsigned char chBeforePrev = 0; + unsigned char chPrev = 0; +- for (int i = 0; i < length; i++) { ++ for (Sci::Position i = 0; i < length; i++) { + const unsigned char ch = s[i]; + if ((ch == '\r') || (ch == '\n')) { + return true; +@@ -519,11 +519,11 @@ + lv.SetPerLine(pl); + } + +-int CellBuffer::Lines() const { ++Sci::Line CellBuffer::Lines() const { + return lv.Lines(); + } + +-int CellBuffer::LineStart(int line) const { ++Sci::Position CellBuffer::LineStart(Sci::Line line) const { + if (line < 0) + return 0; + else if (line >= Lines()) +@@ -566,15 +566,15 @@ + + // Without undo + +-void CellBuffer::InsertLine(int line, int position, bool lineStart) { ++void CellBuffer::InsertLine(Sci::Line line, Sci::Position position, bool lineStart) { + lv.InsertLine(line, position, lineStart); + } + +-void CellBuffer::RemoveLine(int line) { ++void CellBuffer::RemoveLine(Sci::Line line) { + lv.RemoveLine(line); + } + +-bool CellBuffer::UTF8LineEndOverlaps(int position) const { ++bool CellBuffer::UTF8LineEndOverlaps(Sci::Position position) const { + unsigned char bytes[] = { + static_cast<unsigned char>(substance.ValueAt(position-2)), + static_cast<unsigned char>(substance.ValueAt(position-1)), +@@ -588,14 +588,14 @@ + // Reinitialize line data -- too much work to preserve + lv.Init(); + +- int position = 0; +- int length = Length(); +- int lineInsert = 1; ++ Sci::Position position = 0; ++ Sci::Position length = Length(); ++ Sci::Line lineInsert = 1; + bool atLineStart = true; + lv.InsertText(lineInsert-1, length); + unsigned char chBeforePrev = 0; + unsigned char chPrev = 0; +- for (int i = 0; i < length; i++) { ++ for (Sci::Position i = 0; i < length; i++) { + unsigned char ch = substance.ValueAt(position + i); + if (ch == '\r') { + InsertLine(lineInsert, (position + i) + 1, atLineStart); +@@ -620,7 +620,7 @@ + } + } + +-void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) { ++void CellBuffer::BasicInsertString(Sci::Position position, const char *s, Sci::Position insertLength) { + if (insertLength == 0) + return; + PLATFORM_ASSERT(insertLength > 0); +@@ -634,7 +634,7 @@ + substance.InsertFromArray(position, s, 0, insertLength); + style.InsertValue(position, insertLength, 0); + +- int lineInsert = lv.LineFromPosition(position) + 1; ++ Sci::Line lineInsert = lv.LineFromPosition(position) + 1; + bool atLineStart = lv.LineStart(lineInsert-1) == position; + // Point all the lines after the insertion point further along in the buffer + lv.InsertText(lineInsert-1, insertLength); +@@ -649,7 +649,7 @@ + RemoveLine(lineInsert); + } + unsigned char ch = ' '; +- for (int i = 0; i < insertLength; i++) { ++ for (Sci::Position i = 0; i < insertLength; i++) { + ch = s[i]; + if (ch == '\r') { + InsertLine(lineInsert, (position + i) + 1, atLineStart); +@@ -697,7 +697,7 @@ + } + } + +-void CellBuffer::BasicDeleteChars(int position, int deleteLength) { ++void CellBuffer::BasicDeleteChars(Sci::Position position, Sci::Position deleteLength) { + if (deleteLength == 0) + return; + +@@ -709,7 +709,7 @@ + // Have to fix up line positions before doing deletion as looking at text in buffer + // to work out which lines have been removed + +- int lineRemove = lv.LineFromPosition(position) + 1; ++ Sci::Line lineRemove = lv.LineFromPosition(position) + 1; + lv.InsertText(lineRemove-1, - (deleteLength)); + unsigned char chPrev = substance.ValueAt(position - 1); + unsigned char chBefore = chPrev; +@@ -728,7 +728,7 @@ + } + + unsigned char ch = chNext; +- for (int i = 0; i < deleteLength; i++) { ++ for (Sci::Position i = 0; i < deleteLength; i++) { + chNext = substance.ValueAt(position + i + 1); + if (ch == '\r') { + if (chNext != '\n') { +@@ -783,7 +783,7 @@ + uh.EndUndoAction(); + } + +-void CellBuffer::AddUndoAction(int token, bool mayCoalesce) { ++void CellBuffer::AddUndoAction(Sci::Position token, bool mayCoalesce) { + bool startSequence; + uh.AppendAction(containerAction, token, 0, 0, startSequence, mayCoalesce); + } +diff -r 1788f6795302 -r a0f26eaf474d src/CellBuffer.h +--- a/src/CellBuffer.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/CellBuffer.h Fri Mar 31 18:19:38 2017 +1100 +@@ -17,8 +17,8 @@ + public: + virtual ~PerLine() {} + virtual void Init()=0; +- virtual void InsertLine(int line)=0; +- virtual void RemoveLine(int line)=0; ++ virtual void InsertLine(Sci::Line line)=0; ++ virtual void RemoveLine(Sci::Line line)=0; + }; + + /** +@@ -36,15 +36,15 @@ + void Init(); + void SetPerLine(PerLine *pl); + +- void InsertText(int line, int delta); +- void InsertLine(int line, int position, bool lineStart); +- void SetLineStart(int line, int position); +- void RemoveLine(int line); +- int Lines() const { ++ void InsertText(Sci::Line line, Sci::Position delta); ++ void InsertLine(Sci::Line line, Sci::Position position, bool lineStart); ++ void SetLineStart(Sci::Line line, Sci::Position position); ++ void RemoveLine(Sci::Line line); ++ Sci::Line Lines() const { + return starts.Partitions(); + } +- int LineFromPosition(int pos) const; +- int LineStart(int line) const { ++ Sci::Line LineFromPosition(Sci::Position pos) const; ++ Sci::Position LineStart(Sci::Line line) const { + return starts.PositionFromPartition(line); + } + }; +@@ -57,14 +57,14 @@ + class Action { + public: + actionType at; +- int position; ++ Sci::Position position; + char *data; +- int lenData; ++ Sci::Position lenData; + bool mayCoalesce; + + Action(); + ~Action(); +- void Create(actionType at_, int position_=0, const char *data_=0, int lenData_=0, bool mayCoalesce_=true); ++ void Create(actionType at_, Sci::Position position_=0, const char *data_=0, Sci::Position lenData_=0, bool mayCoalesce_=true); + void Destroy(); + void Grab(Action *source); + }; +@@ -90,7 +90,7 @@ + UndoHistory(); + ~UndoHistory(); + +- const char *AppendAction(actionType at, int position, const char *data, int length, bool &startSequence, bool mayCoalesce=true); ++ const char *AppendAction(actionType at, Sci::Position position, const char *data, Sci::Position length, bool &startSequence, bool mayCoalesce=true); + + void BeginUndoAction(); + void EndUndoAction(); +@@ -137,11 +137,11 @@ + + LineVector lv; + +- bool UTF8LineEndOverlaps(int position) const; ++ bool UTF8LineEndOverlaps(Sci::Position position) const; + void ResetLineEnds(); + /// Actions without undo +- void BasicInsertString(int position, const char *s, int insertLength); +- void BasicDeleteChars(int position, int deleteLength); ++ void BasicInsertString(Sci::Position position, const char *s, Sci::Position insertLength); ++ void BasicDeleteChars(Sci::Position position, Sci::Position deleteLength); + + public: + +@@ -149,33 +149,33 @@ + ~CellBuffer(); + + /// Retrieving positions outside the range of the buffer works and returns 0 +- char CharAt(int position) const; +- void GetCharRange(char *buffer, int position, int lengthRetrieve) const; +- char StyleAt(int position) const; +- void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const; ++ char CharAt(Sci::Position position) const; ++ void GetCharRange(char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const; ++ char StyleAt(Sci::Position position) const; ++ void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const; + const char *BufferPointer(); +- const char *RangePointer(int position, int rangeLength); +- int GapPosition() const; ++ const char *RangePointer(Sci::Position position, Sci::Position rangeLength); ++ Sci::Position GapPosition() const; + +- int Length() const; +- void Allocate(int newSize); ++ Sci::Position Length() const; ++ void Allocate(Sci::Position newSize); + int GetLineEndTypes() const { return utf8LineEnds; } + void SetLineEndTypes(int utf8LineEnds_); +- bool ContainsLineEnd(const char *s, int length) const; ++ bool ContainsLineEnd(const char *s, Sci::Position length) const; + void SetPerLine(PerLine *pl); +- int Lines() const; +- int LineStart(int line) const; +- int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); } +- void InsertLine(int line, int position, bool lineStart); +- void RemoveLine(int line); +- const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); ++ Sci::Line Lines() const; ++ Sci::Position LineStart(Sci::Line line) const; ++ Sci::Line LineFromPosition(Sci::Position pos) const { return lv.LineFromPosition(pos); } ++ void InsertLine(Sci::Line line, Sci::Position position, bool lineStart); ++ void RemoveLine(Sci::Line line); ++ const char *InsertString(Sci::Position position, const char *s, Sci::Position insertLength, bool &startSequence); + + /// Setting styles for positions outside the range of the buffer is safe and has no effect. + /// @return true if the style of a character is changed. +- bool SetStyleAt(int position, char styleValue); +- bool SetStyleFor(int position, int length, char styleValue); ++ bool SetStyleAt(Sci::Position position, char styleValue); ++ bool SetStyleFor(Sci::Position position, Sci::Position length, char styleValue); + +- const char *DeleteChars(int position, int deleteLength, bool &startSequence); ++ const char *DeleteChars(Sci::Position position, Sci::Position deleteLength, bool &startSequence); + + bool IsReadOnly() const; + void SetReadOnly(bool set); +@@ -194,7 +194,7 @@ + bool IsCollectingUndo() const; + void BeginUndoAction(); + void EndUndoAction(); +- void AddUndoAction(int token, bool mayCoalesce); ++ void AddUndoAction(Sci::Position token, bool mayCoalesce); + void DeleteUndoHistory(); + + /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is +diff -r 1788f6795302 -r a0f26eaf474d src/ContractionState.cxx +--- a/src/ContractionState.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/ContractionState.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -57,7 +57,7 @@ + linesInDocument = 1; + } + +-int ContractionState::LinesInDoc() const { ++Sci::Line ContractionState::LinesInDoc() const { + if (OneToOne()) { + return linesInDocument; + } else { +@@ -65,7 +65,7 @@ + } + } + +-int ContractionState::LinesDisplayed() const { ++Sci::Line ContractionState::LinesDisplayed() const { + if (OneToOne()) { + return linesInDocument; + } else { +@@ -73,7 +73,7 @@ + } + } + +-int ContractionState::DisplayFromDoc(int lineDoc) const { ++Sci::Line ContractionState::DisplayFromDoc(Sci::Line lineDoc) const { + if (OneToOne()) { + return (lineDoc <= linesInDocument) ? lineDoc : linesInDocument; + } else { +@@ -83,11 +83,11 @@ + } + } + +-int ContractionState::DisplayLastFromDoc(int lineDoc) const { ++Sci::Line ContractionState::DisplayLastFromDoc(Sci::Line lineDoc) const { + return DisplayFromDoc(lineDoc) + GetHeight(lineDoc) - 1; + } + +-int ContractionState::DocFromDisplay(int lineDisplay) const { ++Sci::Line ContractionState::DocFromDisplay(Sci::Line lineDisplay) const { + if (OneToOne()) { + return lineDisplay; + } else { +@@ -97,13 +97,13 @@ + if (lineDisplay > LinesDisplayed()) { + return displayLines->PartitionFromPosition(LinesDisplayed()); + } +- int lineDoc = displayLines->PartitionFromPosition(lineDisplay); ++ Sci::Line lineDoc = displayLines->PartitionFromPosition(lineDisplay); + PLATFORM_ASSERT(GetVisible(lineDoc)); + return lineDoc; + } + } + +-void ContractionState::InsertLine(int lineDoc) { ++void ContractionState::InsertLine(Sci::Line lineDoc) { + if (OneToOne()) { + linesInDocument++; + } else { +@@ -115,20 +115,20 @@ + heights->SetValueAt(lineDoc, 1); + foldDisplayTexts->InsertSpace(lineDoc, 1); + foldDisplayTexts->SetValueAt(lineDoc, NULL); +- int lineDisplay = DisplayFromDoc(lineDoc); ++ Sci::Line lineDisplay = DisplayFromDoc(lineDoc); + displayLines->InsertPartition(lineDoc, lineDisplay); + displayLines->InsertText(lineDoc, 1); + } + } + +-void ContractionState::InsertLines(int lineDoc, int lineCount) { ++void ContractionState::InsertLines(Sci::Line lineDoc, Sci::Line lineCount) { + for (int l = 0; l < lineCount; l++) { + InsertLine(lineDoc + l); + } + Check(); + } + +-void ContractionState::DeleteLine(int lineDoc) { ++void ContractionState::DeleteLine(Sci::Line lineDoc) { + if (OneToOne()) { + linesInDocument--; + } else { +@@ -143,14 +143,14 @@ + } + } + +-void ContractionState::DeleteLines(int lineDoc, int lineCount) { +- for (int l = 0; l < lineCount; l++) { ++void ContractionState::DeleteLines(Sci::Line lineDoc, Sci::Line lineCount) { ++ for (Sci::Line l = 0; l < lineCount; l++) { + DeleteLine(lineDoc); + } + Check(); + } + +-bool ContractionState::GetVisible(int lineDoc) const { ++bool ContractionState::GetVisible(Sci::Line lineDoc) const { + if (OneToOne()) { + return true; + } else { +@@ -160,15 +160,15 @@ + } + } + +-bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool isVisible) { ++bool ContractionState::SetVisible(Sci::Line lineDocStart, Sci::Line lineDocEnd, bool isVisible) { + if (OneToOne() && isVisible) { + return false; + } else { + EnsureData(); +- int delta = 0; ++ Sci::Line delta = 0; + Check(); + if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) { +- for (int line = lineDocStart; line <= lineDocEnd; line++) { ++ for (Sci::Line line = lineDocStart; line <= lineDocEnd; line++) { + if (GetVisible(line) != isVisible) { + int difference = isVisible ? heights->ValueAt(line) : -heights->ValueAt(line); + visible->SetValueAt(line, isVisible ? 1 : 0); +@@ -192,12 +192,12 @@ + } + } + +-const char *ContractionState::GetFoldDisplayText(int lineDoc) const { ++const char *ContractionState::GetFoldDisplayText(Sci::Line lineDoc) const { + Check(); + return foldDisplayTexts->ValueAt(lineDoc); + } + +-bool ContractionState::SetFoldDisplayText(int lineDoc, const char *text) { ++bool ContractionState::SetFoldDisplayText(Sci::Line lineDoc, const char *text) { + EnsureData(); + const char *foldText = foldDisplayTexts->ValueAt(lineDoc); + if (!foldText || 0 != strcmp(text, foldText)) { +@@ -210,7 +210,7 @@ + } + } + +-bool ContractionState::GetExpanded(int lineDoc) const { ++bool ContractionState::GetExpanded(Sci::Line lineDoc) const { + if (OneToOne()) { + return true; + } else { +@@ -219,7 +219,7 @@ + } + } + +-bool ContractionState::SetExpanded(int lineDoc, bool isExpanded) { ++bool ContractionState::SetExpanded(Sci::Line lineDoc, bool isExpanded) { + if (OneToOne() && isExpanded) { + return false; + } else { +@@ -235,11 +235,11 @@ + } + } + +-bool ContractionState::GetFoldDisplayTextShown(int lineDoc) const { ++bool ContractionState::GetFoldDisplayTextShown(Sci::Line lineDoc) const { + return !GetExpanded(lineDoc) && GetFoldDisplayText(lineDoc); + } + +-int ContractionState::ContractedNext(int lineDocStart) const { ++Sci::Line ContractionState::ContractedNext(Sci::Line lineDocStart) const { + if (OneToOne()) { + return -1; + } else { +@@ -247,7 +247,7 @@ + if (!expanded->ValueAt(lineDocStart)) { + return lineDocStart; + } else { +- int lineDocNextChange = expanded->EndRun(lineDocStart); ++ Sci::Line lineDocNextChange = expanded->EndRun(lineDocStart); + if (lineDocNextChange < LinesInDoc()) + return lineDocNextChange; + else +@@ -256,7 +256,7 @@ + } + } + +-int ContractionState::GetHeight(int lineDoc) const { ++int ContractionState::GetHeight(Sci::Line lineDoc) const { + if (OneToOne()) { + return 1; + } else { +@@ -266,7 +266,7 @@ + + // Set the number of display lines needed for this line. + // Return true if this is a change. +-bool ContractionState::SetHeight(int lineDoc, int height) { ++bool ContractionState::SetHeight(Sci::Line lineDoc, int height) { + if (OneToOne() && (height == 1)) { + return false; + } else if (lineDoc < LinesInDoc()) { +@@ -288,7 +288,7 @@ + } + + void ContractionState::ShowAll() { +- int lines = LinesInDoc(); ++ Sci::Line lines = LinesInDoc(); + Clear(); + linesInDocument = lines; + } +@@ -297,14 +297,14 @@ + + void ContractionState::Check() const { + #ifdef CHECK_CORRECTNESS +- for (int vline = 0; vline < LinesDisplayed(); vline++) { +- const int lineDoc = DocFromDisplay(vline); ++ for (Sci::Line vline = 0; vline < LinesDisplayed(); vline++) { ++ const Sci::Line lineDoc = DocFromDisplay(vline); + PLATFORM_ASSERT(GetVisible(lineDoc)); + } +- for (int lineDoc = 0; lineDoc < LinesInDoc(); lineDoc++) { +- const int displayThis = DisplayFromDoc(lineDoc); +- const int displayNext = DisplayFromDoc(lineDoc + 1); +- const int height = displayNext - displayThis; ++ for (Sci::Line lineDoc = 0; lineDoc < LinesInDoc(); lineDoc++) { ++ const Sci::Line displayThis = DisplayFromDoc(lineDoc); ++ const Sci::Line displayNext = DisplayFromDoc(lineDoc + 1); ++ const Sci::Line height = displayNext - displayThis; + PLATFORM_ASSERT(height >= 0); + if (GetVisible(lineDoc)) { + PLATFORM_ASSERT(GetHeight(lineDoc) == height); +diff -r 1788f6795302 -r a0f26eaf474d src/ContractionState.h +--- a/src/ContractionState.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/ContractionState.h Fri Mar 31 18:19:38 2017 +1100 +@@ -24,7 +24,7 @@ + RunStyles *heights; + SparseVector<const char *> *foldDisplayTexts; + Partitioning *displayLines; +- int linesInDocument; ++ Sci::Line linesInDocument; + + void EnsureData(); + +@@ -40,31 +40,31 @@ + + void Clear(); + +- int LinesInDoc() const; +- int LinesDisplayed() const; +- int DisplayFromDoc(int lineDoc) const; +- int DisplayLastFromDoc(int lineDoc) const; +- int DocFromDisplay(int lineDisplay) const; ++ Sci::Line LinesInDoc() const; ++ Sci::Line LinesDisplayed() const; ++ Sci::Line DisplayFromDoc(Sci::Line lineDoc) const; ++ Sci::Line DisplayLastFromDoc(Sci::Line lineDoc) const; ++ Sci::Line DocFromDisplay(Sci::Line lineDisplay) const; + +- void InsertLine(int lineDoc); +- void InsertLines(int lineDoc, int lineCount); +- void DeleteLine(int lineDoc); +- void DeleteLines(int lineDoc, int lineCount); ++ void InsertLine(Sci::Line lineDoc); ++ void InsertLines(Sci::Line lineDoc, Sci::Line lineCount); ++ void DeleteLine(Sci::Line lineDoc); ++ void DeleteLines(Sci::Line lineDoc, Sci::Line lineCount); + +- bool GetVisible(int lineDoc) const; +- bool SetVisible(int lineDocStart, int lineDocEnd, bool isVisible); ++ bool GetVisible(Sci::Line lineDoc) const; ++ bool SetVisible(Sci::Line lineDocStart, Sci::Line lineDocEnd, bool isVisible); + bool HiddenLines() const; + +- const char *GetFoldDisplayText(int lineDoc) const; +- bool SetFoldDisplayText(int lineDoc, const char *text); ++ const char *GetFoldDisplayText(Sci::Line lineDoc) const; ++ bool SetFoldDisplayText(Sci::Line lineDoc, const char *text); + +- bool GetExpanded(int lineDoc) const; +- bool SetExpanded(int lineDoc, bool isExpanded); +- bool GetFoldDisplayTextShown(int lineDoc) const; +- int ContractedNext(int lineDocStart) const; ++ bool GetExpanded(Sci::Line lineDoc) const; ++ bool SetExpanded(Sci::Line lineDoc, bool isExpanded); ++ bool GetFoldDisplayTextShown(Sci::Line lineDoc) const; ++ Sci::Line ContractedNext(Sci::Line lineDocStart) const; + +- int GetHeight(int lineDoc) const; +- bool SetHeight(int lineDoc, int height); ++ int GetHeight(Sci::Line lineDoc) const; ++ bool SetHeight(Sci::Line lineDoc, int height); + + void ShowAll(); + void Check() const; +diff -r 1788f6795302 -r a0f26eaf474d src/Document.cxx +--- a/src/Document.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/Document.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -54,17 +54,17 @@ + using namespace Scintilla; + #endif + +-void LexInterface::Colourise(int start, int end) { ++void LexInterface::Colourise(Sci::Position start, Sci::Position end) { + if (pdoc && instance && !performingStyle) { + // Protect against reentrance, which may occur, for example, when + // fold points are discovered while performing styling and the folding + // code looks for child lines which may trigger styling. + performingStyle = true; + +- int lengthDoc = pdoc->Length(); ++ Sci::Position lengthDoc = pdoc->Length(); + if (end == -1) + end = lengthDoc; +- int len = end - start; ++ Sci::Position len = end - start; + + PLATFORM_ASSERT(len >= 0); + PLATFORM_ASSERT(start + len <= lengthDoc); +@@ -189,14 +189,14 @@ + } + } + +-void Document::InsertLine(int line) { ++void Document::InsertLine(Sci::Line line) { + for (int j=0; j<ldSize; j++) { + if (perLineData[j]) + perLineData[j]->InsertLine(line); + } + } + +-void Document::RemoveLine(int line) { ++void Document::RemoveLine(Sci::Line line) { + for (int j=0; j<ldSize; j++) { + if (perLineData[j]) + perLineData[j]->RemoveLine(line); +@@ -234,7 +234,7 @@ + int steps = cb.TentativeSteps(); + //Platform::DebugPrintf("Steps=%d\n", steps); + for (int step = 0; step < steps; step++) { +- const int prevLinesTotal = LinesTotal(); ++ const Sci::Line prevLinesTotal = LinesTotal(); + const Action &action = cb.GetUndoStep(); + if (action.at == removeAction) { + NotifyModified(DocModification( +@@ -261,7 +261,7 @@ + } + if (steps > 1) + modFlags |= SC_MULTISTEPUNDOREDO; +- const int linesAdded = LinesTotal() - prevLinesTotal; ++ const Sci::Line linesAdded = LinesTotal() - prevLinesTotal; + if (linesAdded != 0) + multiLine = true; + if (step == steps - 1) { +@@ -283,15 +283,15 @@ + } + } + +-int Document::GetMark(int line) { ++int Document::GetMark(Sci::Line line) { + return static_cast<LineMarkers *>(perLineData[ldMarkers])->MarkValue(line); + } + +-int Document::MarkerNext(int lineStart, int mask) const { ++Sci::Line Document::MarkerNext(Sci::Line lineStart, int mask) const { + return static_cast<LineMarkers *>(perLineData[ldMarkers])->MarkerNext(lineStart, mask); + } + +-int Document::AddMark(int line, int markerNum) { ++int Document::AddMark(Sci::Line line, int markerNum) { + if (line >= 0 && line <= LinesTotal()) { + int prev = static_cast<LineMarkers *>(perLineData[ldMarkers])-> + AddMark(line, markerNum, LinesTotal()); +@@ -303,7 +303,7 @@ + } + } + +-void Document::AddMarkSet(int line, int valueSet) { ++void Document::AddMarkSet(Sci::Line line, int valueSet) { + if (line < 0 || line > LinesTotal()) { + return; + } +@@ -316,7 +316,7 @@ + NotifyModified(mh); + } + +-void Document::DeleteMark(int line, int markerNum) { ++void Document::DeleteMark(Sci::Line line, int markerNum) { + static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMark(line, markerNum, false); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +@@ -331,7 +331,7 @@ + + void Document::DeleteAllMarks(int markerNum) { + bool someChanges = false; +- for (int line = 0; line < LinesTotal(); line++) { ++ for (Sci::Line line = 0; line < LinesTotal(); line++) { + if (static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMark(line, markerNum, true)) + someChanges = true; + } +@@ -342,7 +342,7 @@ + } + } + +-int Document::LineFromHandle(int markerHandle) { ++Sci::Line Document::LineFromHandle(int markerHandle) { + return static_cast<LineMarkers *>(perLineData[ldMarkers])->LineFromHandle(markerHandle); + } + +@@ -350,7 +350,7 @@ + return cb.LineStart(line); + } + +-bool Document::IsLineStartPosition(int position) const { ++bool Document::IsLineStartPosition(Sci::Position position) const { + return LineStart(LineFromPosition(position)) == position; + } + +@@ -358,7 +358,7 @@ + if (line >= LinesTotal() - 1) { + return LineStart(line + 1); + } else { +- int position = LineStart(line + 1); ++ Sci::Position position = LineStart(line + 1); + if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char bytes[] = { + static_cast<unsigned char>(cb.CharAt(position-3)), +@@ -392,23 +392,23 @@ + return cb.LineFromPosition(pos); + } + +-int Document::LineEndPosition(int position) const { ++Sci::Position Document::LineEndPosition(Sci::Position position) const { + return LineEnd(LineFromPosition(position)); + } + +-bool Document::IsLineEndPosition(int position) const { ++bool Document::IsLineEndPosition(Sci::Position position) const { + return LineEnd(LineFromPosition(position)) == position; + } + +-bool Document::IsPositionInLineEnd(int position) const { ++bool Document::IsPositionInLineEnd(Sci::Position position) const { + return position >= LineEnd(LineFromPosition(position)); + } + +-int Document::VCHomePosition(int position) const { +- int line = LineFromPosition(position); +- int startPosition = LineStart(line); +- int endLine = LineEnd(line); +- int startText = startPosition; ++Sci::Position Document::VCHomePosition(Sci::Position position) const { ++ Sci::Line line = LineFromPosition(position); ++ Sci::Position startPosition = LineStart(line); ++ Sci::Position endLine = LineEnd(line); ++ Sci::Position startText = startPosition; + while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t')) + startText++; + if (position == startText) +@@ -444,12 +444,12 @@ + return LevelNumber(levelStart) < LevelNumber(levelTry); + } + +-int Document::GetLastChild(int lineParent, int level, int lastLine) { ++Sci::Line Document::GetLastChild(Sci::Line lineParent, int level, Sci::Line lastLine) { + if (level == -1) + level = LevelNumber(GetLevel(lineParent)); +- int maxLine = LinesTotal(); +- int lookLastLine = (lastLine != -1) ? Platform::Minimum(LinesTotal() - 1, lastLine) : -1; +- int lineMaxSubord = lineParent; ++ Sci::Line maxLine = LinesTotal(); ++ Sci::Line lookLastLine = (lastLine != -1) ? Platform::Minimum(LinesTotal() - 1, lastLine) : -1; ++ Sci::Line lineMaxSubord = lineParent; + while (lineMaxSubord < maxLine - 1) { + EnsureStyledTo(LineStart(lineMaxSubord + 2)); + if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1))) +@@ -469,9 +469,9 @@ + return lineMaxSubord; + } + +-int Document::GetFoldParent(int line) const { ++Sci::Line Document::GetFoldParent(Sci::Line line) const { + int level = LevelNumber(GetLevel(line)); +- int lineLook = line - 1; ++ Sci::Line lineLook = line - 1; + while ((lineLook > 0) && ( + (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || + (LevelNumber(GetLevel(lineLook)) >= level)) +@@ -486,11 +486,11 @@ + } + } + +-void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, int line, int lastLine) { ++void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, Sci::Line line, Sci::Line lastLine) { + int level = GetLevel(line); +- int lookLastLine = Platform::Maximum(line, lastLine) + 1; ++ Sci::Line lookLastLine = Platform::Maximum(line, lastLine) + 1; + +- int lookLine = line; ++ Sci::Line lookLine = line; + int lookLineLevel = level; + int lookLineLevelNum = LevelNumber(lookLineLevel); + while ((lookLine > 0) && ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || +@@ -499,14 +499,14 @@ + lookLineLevelNum = LevelNumber(lookLineLevel); + } + +- int beginFoldBlock = (lookLineLevel & SC_FOLDLEVELHEADERFLAG) ? lookLine : GetFoldParent(lookLine); ++ Sci::Line beginFoldBlock = (lookLineLevel & SC_FOLDLEVELHEADERFLAG) ? lookLine : GetFoldParent(lookLine); + if (beginFoldBlock == -1) { + highlightDelimiter.Clear(); + return; + } + +- int endFoldBlock = GetLastChild(beginFoldBlock, -1, lookLastLine); +- int firstChangeableLineBefore = -1; ++ Sci::Line endFoldBlock = GetLastChild(beginFoldBlock, -1, lookLastLine); ++ Sci::Line firstChangeableLineBefore = -1; + if (endFoldBlock < line) { + lookLine = beginFoldBlock - 1; + lookLineLevel = GetLevel(lookLine); +@@ -538,7 +538,7 @@ + if (firstChangeableLineBefore == -1) + firstChangeableLineBefore = beginFoldBlock - 1; + +- int firstChangeableLineAfter = -1; ++ Sci::Line firstChangeableLineAfter = -1; + for (lookLine = line + 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = LevelNumber(lookLineLevel); + lookLine <= endFoldBlock; + lookLineLevel = GetLevel(++lookLine), lookLineLevelNum = LevelNumber(lookLineLevel)) { +@@ -556,11 +556,11 @@ + highlightDelimiter.firstChangeableLineAfter = firstChangeableLineAfter; + } + +-int Document::ClampPositionIntoDocument(int pos) const { ++Sci::Position Document::ClampPositionIntoDocument(Sci::Position pos) const { + return Platform::Clamp(pos, 0, Length()); + } + +-bool Document::IsCrLf(int pos) const { ++bool Document::IsCrLf(Sci::Position pos) const { + if (pos < 0) + return false; + if (pos >= (Length() - 1)) +@@ -568,7 +568,7 @@ + return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n'); + } + +-int Document::LenChar(int pos) { ++int Document::LenChar(Sci::Position pos) { + if (pos < 0) { + return 1; + } else if (IsCrLf(pos)) { +@@ -576,7 +576,7 @@ + } else if (SC_CP_UTF8 == dbcsCodePage) { + const unsigned char leadByte = static_cast<unsigned char>(cb.CharAt(pos)); + const int widthCharBytes = UTF8BytesOfLead[leadByte]; +- int lengthDoc = Length(); ++ Sci::Position lengthDoc = Length(); + if ((pos + widthCharBytes) > lengthDoc) + return lengthDoc - pos; + else +@@ -588,8 +588,8 @@ + } + } + +-bool Document::InGoodUTF8(int pos, int &start, int &end) const { +- int trail = pos; ++bool Document::InGoodUTF8(Sci::Position pos, Sci::Position &start, Sci::Position &end) const { ++ Sci::Position trail = pos; + while ((trail>0) && (pos-trail < UTF8MaxBytes) && UTF8IsTrailByte(static_cast<unsigned char>(cb.CharAt(trail-1)))) + trail--; + start = (trail > 0) ? trail-1 : trail; +@@ -600,13 +600,13 @@ + return false; + } else { + int trailBytes = widthCharBytes - 1; +- int len = pos - start; ++ Sci::Position len = pos - start; + if (len > trailBytes) + // pos too far from lead + return false; + char charBytes[UTF8MaxBytes] = {static_cast<char>(leadByte),0,0,0}; + for (int b=1; b<widthCharBytes && ((start+b) < Length()); b++) +- charBytes[b] = cb.CharAt(static_cast<int>(start+b)); ++ charBytes[b] = cb.CharAt(static_cast<Sci::Position>(start+b)); + int utf8status = UTF8Classify(reinterpret_cast<const unsigned char *>(charBytes), widthCharBytes); + if (utf8status & UTF8MaskInvalid) + return false; +@@ -620,7 +620,7 @@ + // When lines are terminated with \r\n pairs which should be treated as one character. + // When displaying DBCS text such as Japanese. + // If moving, move the position in the indicated direction. +-int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) const { ++Sci::Position Document::MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd) const { + //Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir); + // If out of range, just return minimum/maximum value. + if (pos <= 0) +@@ -641,8 +641,8 @@ + unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); + // If ch is not a trail byte then pos is valid intercharacter position + if (UTF8IsTrailByte(ch)) { +- int startUTF = pos; +- int endUTF = pos; ++ Sci::Position startUTF = pos; ++ Sci::Position endUTF = pos; + if (InGoodUTF8(pos, startUTF, endUTF)) { + // ch is a trail byte within a UTF-8 character + if (moveDir > 0) +@@ -655,12 +655,12 @@ + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. +- int posStartLine = LineStart(LineFromPosition(pos)); ++ Sci::Position posStartLine = LineStart(LineFromPosition(pos)); + if (pos == posStartLine) + return pos; + + // Step back until a non-lead-byte is found. +- int posCheck = pos; ++ Sci::Position posCheck = pos; + while ((posCheck > posStartLine) && IsDBCSLeadByte(cb.CharAt(posCheck-1))) + posCheck--; + +@@ -687,7 +687,7 @@ + // NextPosition moves between valid positions - it can not handle a position in the middle of a + // multi-byte character. It is used to iterate through text more efficiently than MovePositionOutsideChar. + // A \r\n pair is treated as two characters. +-int Document::NextPosition(int pos, int moveDir) const { ++Sci::Position Document::NextPosition(Sci::Position pos, int moveDir) const { + // If out of range, just return minimum/maximum value. + int increment = (moveDir > 0) ? 1 : -1; + if (pos + increment <= 0) +@@ -721,8 +721,8 @@ + // If ch is not a trail byte then pos is valid intercharacter position + if (UTF8IsTrailByte(ch)) { + // If ch is a trail byte in a valid UTF-8 character then return start of character +- int startUTF = pos; +- int endUTF = pos; ++ Sci::Position startUTF = pos; ++ Sci::Position endUTF = pos; + if (InGoodUTF8(pos, startUTF, endUTF)) { + pos = startUTF; + } +@@ -738,7 +738,7 @@ + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. +- int posStartLine = LineStart(LineFromPosition(pos)); ++ Sci::Position posStartLine = LineStart(LineFromPosition(pos)); + // See http://msdn.microsoft.com/en-us/library/cc194792%28v=MSDN.10%29.aspx + // http://msdn.microsoft.com/en-us/library/cc194790.aspx + if ((pos - 1) <= posStartLine) { +@@ -748,7 +748,7 @@ + return pos - 2; + } else { + // Otherwise, step back until a non-lead-byte is found. +- int posTemp = pos - 1; ++ Sci::Position posTemp = pos - 1; + while (posStartLine <= --posTemp && IsDBCSLeadByte(cb.CharAt(posTemp))) + ; + // Now posTemp+1 must point to the beginning of a character, +@@ -765,9 +765,9 @@ + return pos; + } + +-bool Document::NextCharacter(int &pos, int moveDir) const { ++bool Document::NextCharacter(Sci::Position &pos, int moveDir) const { + // Returns true if pos changed +- int posNext = NextPosition(pos, moveDir); ++ Sci::Position posNext = NextPosition(pos, moveDir); + if (posNext == pos) { + return false; + } else { +@@ -776,7 +776,7 @@ + } + } + +-Document::CharacterExtracted Document::CharacterAfter(int position) const { ++Document::CharacterExtracted Document::CharacterAfter(Sci::Position position) const { + if (position >= Length()) { + return CharacterExtracted(unicodeReplacementChar, 0); + } +@@ -806,7 +806,7 @@ + } + } + +-Document::CharacterExtracted Document::CharacterBefore(int position) const { ++Document::CharacterExtracted Document::CharacterBefore(Sci::Position position) const { + if (position <= 0) { + return CharacterExtracted(unicodeReplacementChar, 0); + } +@@ -822,8 +822,8 @@ + // If previousByte is not a trail byte then its invalid + if (UTF8IsTrailByte(previousByte)) { + // If previousByte is a trail byte in a valid UTF-8 character then find start of character +- int startUTF = position; +- int endUTF = position; ++ Sci::Position startUTF = position; ++ Sci::Position endUTF = position; + if (InGoodUTF8(position, startUTF, endUTF)) { + const int widthCharBytes = endUTF - startUTF; + unsigned char charBytes[UTF8MaxBytes] = { 0, 0, 0, 0 }; +@@ -842,18 +842,18 @@ + return CharacterExtracted(unicodeReplacementChar, 1); + } else { + // Moving backwards in DBCS is complex so use NextPosition +- const int posStartCharacter = NextPosition(position, -1); ++ const Sci::Position posStartCharacter = NextPosition(position, -1); + return CharacterAfter(posStartCharacter); + } + } + + // Return -1 on out-of-bounds + Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const { +- int pos = positionStart; ++ Sci::Position pos = positionStart; + if (dbcsCodePage) { + const int increment = (characterOffset > 0) ? 1 : -1; + while (characterOffset != 0) { +- const int posNext = NextPosition(pos, increment); ++ const Sci::Position posNext = NextPosition(pos, increment); + if (posNext == pos) + return INVALID_POSITION; + pos = posNext; +@@ -867,12 +867,12 @@ + return pos; + } + +-int Document::GetRelativePositionUTF16(int positionStart, int characterOffset) const { +- int pos = positionStart; ++Sci::Position Document::GetRelativePositionUTF16(Sci::Position positionStart, Sci::Position characterOffset) const { ++ Sci::Position pos = positionStart; + if (dbcsCodePage) { + const int increment = (characterOffset > 0) ? 1 : -1; + while (characterOffset != 0) { +- const int posNext = NextPosition(pos, increment); ++ const Sci::Position posNext = NextPosition(pos, increment); + if (posNext == pos) + return INVALID_POSITION; + if (abs(pos-posNext) > 3) // 4 byte character = 2*UTF16. +@@ -1018,7 +1018,7 @@ + return efEightBit; + } + +-void Document::ModifiedAt(int pos) { ++void Document::ModifiedAt(Sci::Position pos) { + if (endStyled > pos) + endStyled = pos; + } +@@ -1034,7 +1034,7 @@ + // Document only modified by gateways DeleteChars, InsertString, Undo, Redo, and SetStyleAt. + // SetStyleAt does not change the persistent state of a document + +-bool Document::DeleteChars(int pos, int len) { ++bool Document::DeleteChars(Sci::Position pos, Sci::Position len) { + if (pos < 0) + return false; + if (len <= 0) +@@ -1052,7 +1052,7 @@ + SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, + pos, len, + 0, 0)); +- int prevLinesTotal = LinesTotal(); ++ Sci::Line prevLinesTotal = LinesTotal(); + bool startSavePoint = cb.IsSavePoint(); + bool startSequence = false; + const char *text = cb.DeleteChars(pos, len, startSequence); +@@ -1076,7 +1076,7 @@ + /** + * Insert a string with a length. + */ +-int Document::InsertString(int position, const char *s, int insertLength) { ++Sci::Position Document::InsertString(Sci::Position position, const char *s, Sci::Position insertLength) { + if (insertLength <= 0) { + return 0; + } +@@ -1104,7 +1104,7 @@ + SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, + position, insertLength, + 0, s)); +- int prevLinesTotal = LinesTotal(); ++ Sci::Line prevLinesTotal = LinesTotal(); + bool startSavePoint = cb.IsSavePoint(); + bool startSequence = false; + const char *text = cb.InsertString(position, s, insertLength, startSequence); +@@ -1123,14 +1123,14 @@ + return insertLength; + } + +-void Document::ChangeInsertion(const char *s, int length) { ++void Document::ChangeInsertion(const char *s, Sci::Position length) { + insertionSet = true; + insertion.assign(s, length); + } + + int SCI_METHOD Document::AddData(char *data, Sci_Position length) { + try { +- int position = Length(); ++ Sci::Position position = Length(); + InsertString(position, data, length); + } catch (std::bad_alloc &) { + return SC_STATUS_BADALLOC; +@@ -1144,8 +1144,8 @@ + return this; + } + +-int Document::Undo() { +- int newPos = -1; ++Sci::Position Document::Undo() { ++ Sci::Position newPos = -1; + CheckReadOnly(); + if ((enteredModification == 0) && (cb.IsCollectingUndo())) { + enteredModification++; +@@ -1154,12 +1154,12 @@ + bool multiLine = false; + int steps = cb.StartUndo(); + //Platform::DebugPrintf("Steps=%d\n", steps); +- int coalescedRemovePos = -1; +- int coalescedRemoveLen = 0; +- int prevRemoveActionPos = -1; +- int prevRemoveActionLen = 0; ++ Sci::Position coalescedRemovePos = -1; ++ Sci::Position coalescedRemoveLen = 0; ++ Sci::Position prevRemoveActionPos = -1; ++ Sci::Position prevRemoveActionLen = 0; + for (int step = 0; step < steps; step++) { +- const int prevLinesTotal = LinesTotal(); ++ const Sci::Line prevLinesTotal = LinesTotal(); + const Action &action = cb.GetUndoStep(); + if (action.at == removeAction) { + NotifyModified(DocModification( +@@ -1208,7 +1208,7 @@ + } + if (steps > 1) + modFlags |= SC_MULTISTEPUNDOREDO; +- const int linesAdded = LinesTotal() - prevLinesTotal; ++ const Sci::Line linesAdded = LinesTotal() - prevLinesTotal; + if (linesAdded != 0) + multiLine = true; + if (step == steps - 1) { +@@ -1229,8 +1229,8 @@ + return newPos; + } + +-int Document::Redo() { +- int newPos = -1; ++Sci::Position Document::Redo() { ++ Sci::Position newPos = -1; + CheckReadOnly(); + if ((enteredModification == 0) && (cb.IsCollectingUndo())) { + enteredModification++; +@@ -1239,7 +1239,7 @@ + bool multiLine = false; + int steps = cb.StartRedo(); + for (int step = 0; step < steps; step++) { +- const int prevLinesTotal = LinesTotal(); ++ const Sci::Line prevLinesTotal = LinesTotal(); + const Action &action = cb.GetRedoStep(); + if (action.at == insertAction) { + NotifyModified(DocModification( +@@ -1267,7 +1267,7 @@ + } + if (steps > 1) + modFlags |= SC_MULTISTEPUNDOREDO; +- const int linesAdded = LinesTotal() - prevLinesTotal; ++ const Sci::Line linesAdded = LinesTotal() - prevLinesTotal; + if (linesAdded != 0) + multiLine = true; + if (step == steps - 1) { +@@ -1289,28 +1289,28 @@ + return newPos; + } + +-void Document::DelChar(int pos) { ++void Document::DelChar(Sci::Position pos) { + DeleteChars(pos, LenChar(pos)); + } + +-void Document::DelCharBack(int pos) { ++void Document::DelCharBack(Sci::Position pos) { + if (pos <= 0) { + return; + } else if (IsCrLf(pos - 2)) { + DeleteChars(pos - 2, 2); + } else if (dbcsCodePage) { +- int startChar = NextPosition(pos, -1); ++ Sci::Position startChar = NextPosition(pos, -1); + DeleteChars(startChar, pos - startChar); + } else { + DeleteChars(pos - 1, 1); + } + } + +-static int NextTab(int pos, int tabSize) { ++static Sci::Position NextTab(Sci::Position pos, Sci::Position tabSize) { + return ((pos / tabSize) + 1) * tabSize; + } + +-static std::string CreateIndentation(int indent, int tabSize, bool insertSpaces) { ++static std::string CreateIndentation(Sci::Position indent, int tabSize, bool insertSpaces) { + std::string indentation; + if (!insertSpaces) { + while (indent >= tabSize) { +@@ -1328,9 +1328,9 @@ + int SCI_METHOD Document::GetLineIndentation(Sci_Position line) { + int indent = 0; + if ((line >= 0) && (line < LinesTotal())) { +- int lineStart = LineStart(line); +- int length = Length(); +- for (int i = lineStart; i < length; i++) { ++ Sci::Position lineStart = LineStart(line); ++ Sci::Position length = Length(); ++ for (Sci::Position i = lineStart; i < length; i++) { + char ch = cb.CharAt(i); + if (ch == ' ') + indent++; +@@ -1343,39 +1343,39 @@ + return indent; + } + +-int Document::SetLineIndentation(int line, int indent) { ++Sci::Position Document::SetLineIndentation(Sci::Line line, Sci::Position indent) { + int indentOfLine = GetLineIndentation(line); + if (indent < 0) + indent = 0; + if (indent != indentOfLine) { + std::string linebuf = CreateIndentation(indent, tabInChars, !useTabs); +- int thisLineStart = LineStart(line); +- int indentPos = GetLineIndentPosition(line); ++ Sci::Position thisLineStart = LineStart(line); ++ Sci::Position indentPos = GetLineIndentPosition(line); + UndoGroup ug(this); + DeleteChars(thisLineStart, indentPos - thisLineStart); + return thisLineStart + InsertString(thisLineStart, linebuf.c_str(), +- static_cast<int>(linebuf.length())); ++ static_cast<Sci::Position>(linebuf.length())); + } else { + return GetLineIndentPosition(line); + } + } + +-int Document::GetLineIndentPosition(int line) const { ++Sci::Position Document::GetLineIndentPosition(Sci::Line line) const { + if (line < 0) + return 0; +- int pos = LineStart(line); +- int length = Length(); ++ Sci::Position pos = LineStart(line); ++ Sci::Position length = Length(); + while ((pos < length) && IsSpaceOrTab(cb.CharAt(pos))) { + pos++; + } + return pos; + } + +-int Document::GetColumn(int pos) { +- int column = 0; +- int line = LineFromPosition(pos); ++Sci::Position Document::GetColumn(Sci::Position pos) { ++ Sci::Position column = 0; ++ Sci::Line line = LineFromPosition(pos); + if ((line >= 0) && (line < LinesTotal())) { +- for (int i = LineStart(line); i < pos;) { ++ for (Sci::Position i = LineStart(line); i < pos;) { + char ch = cb.CharAt(i); + if (ch == '\t') { + column = NextTab(column, tabInChars); +@@ -1395,11 +1395,11 @@ + return column; + } + +-int Document::CountCharacters(int startPos, int endPos) const { ++Sci::Position Document::CountCharacters(Sci::Position startPos, Sci::Position endPos) const { + startPos = MovePositionOutsideChar(startPos, 1, false); + endPos = MovePositionOutsideChar(endPos, -1, false); +- int count = 0; +- int i = startPos; ++ Sci::Position count = 0; ++ Sci::Position i = startPos; + while (i < endPos) { + count++; + i = NextPosition(i, 1); +@@ -1407,14 +1407,14 @@ + return count; + } + +-int Document::CountUTF16(int startPos, int endPos) const { ++Sci::Position Document::CountUTF16(Sci::Position startPos, Sci::Position endPos) const { + startPos = MovePositionOutsideChar(startPos, 1, false); + endPos = MovePositionOutsideChar(endPos, -1, false); +- int count = 0; +- int i = startPos; ++ Sci::Position count = 0; ++ Sci::Position i = startPos; + while (i < endPos) { + count++; +- const int next = NextPosition(i, 1); ++ const Sci::Position next = NextPosition(i, 1); + if ((next - i) > 3) + count++; + i = next; +@@ -1422,10 +1422,10 @@ + return count; + } + +-int Document::FindColumn(int line, int column) { +- int position = LineStart(line); ++Sci::Position Document::FindColumn(Sci::Line line, Sci::Position column) { ++ Sci::Position position = LineStart(line); + if ((line >= 0) && (line < LinesTotal())) { +- int columnCurrent = 0; ++ Sci::Position columnCurrent = 0; + while ((columnCurrent < column) && (position < Length())) { + char ch = cb.CharAt(position); + if (ch == '\t') { +@@ -1446,10 +1446,10 @@ + return position; + } + +-void Document::Indent(bool forwards, int lineBottom, int lineTop) { ++void Document::Indent(bool forwards, Sci::Line lineBottom, Sci::Line lineTop) { + // Dedent - suck white space off the front of the line to dedent by equivalent of a tab +- for (int line = lineBottom; line >= lineTop; line--) { +- int indentOfLine = GetLineIndentation(line); ++ for (Sci::Line line = lineBottom; line >= lineTop; line--) { ++ Sci::Position indentOfLine = GetLineIndentation(line); + if (forwards) { + if (LineStart(line) < LineEnd(line)) { + SetLineIndentation(line, indentOfLine + IndentSize()); +@@ -1487,7 +1487,7 @@ + void Document::ConvertLineEnds(int eolModeSet) { + UndoGroup ug(this); + +- for (int pos = 0; pos < Length(); pos++) { ++ for (Sci::Position pos = 0; pos < Length(); pos++) { + if (cb.CharAt(pos) == '\r') { + if (cb.CharAt(pos + 1) == '\n') { + // CRLF +@@ -1522,9 +1522,9 @@ + + } + +-bool Document::IsWhiteLine(int line) const { +- int currentChar = LineStart(line); +- int endLine = LineEnd(line); ++bool Document::IsWhiteLine(Sci::Line line) const { ++ Sci::Position currentChar = LineStart(line); ++ Sci::Position endLine = LineEnd(line); + while (currentChar < endLine) { + if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') { + return false; +@@ -1534,8 +1534,8 @@ + return true; + } + +-int Document::ParaUp(int pos) const { +- int line = LineFromPosition(pos); ++Sci::Position Document::ParaUp(Sci::Position pos) const { ++ Sci::Line line = LineFromPosition(pos); + line--; + while (line >= 0 && IsWhiteLine(line)) { // skip empty lines + line--; +@@ -1547,8 +1547,8 @@ + return LineStart(line); + } + +-int Document::ParaDown(int pos) const { +- int line = LineFromPosition(pos); ++Sci::Position Document::ParaDown(Sci::Position pos) const { ++ Sci::Line line = LineFromPosition(pos); + while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines + line++; + } +@@ -1635,7 +1635,7 @@ + * Used by commmands that want to select whole words. + * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. + */ +-int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) const { ++Sci::Position Document::ExtendWordSelect(Sci::Position pos, int delta, bool onlyWordCharacters) const { + CharClassify::cc ccStart = CharClassify::ccWord; + if (delta < 0) { + if (!onlyWordCharacters) { +@@ -1670,7 +1670,7 @@ + * additional movement to transit white space. + * Used by cursor movement by word commands. + */ +-int Document::NextWordStart(int pos, int delta) const { ++Sci::Position Document::NextWordStart(Sci::Position pos, int delta) const { + if (delta < 0) { + while (pos > 0) { + const CharacterExtracted ce = CharacterBefore(pos); +@@ -1714,7 +1714,7 @@ + * additional movement to transit white space. + * Used by cursor movement by word commands. + */ +-int Document::NextWordEnd(int pos, int delta) const { ++Sci::Position Document::NextWordEnd(Sci::Position pos, int delta) const { + if (delta < 0) { + if (pos > 0) { + CharacterExtracted ce = CharacterBefore(pos); +@@ -1759,7 +1759,7 @@ + * Check that the character at the given position is a word or punctuation character and that + * the previous character is of a different character class. + */ +-bool Document::IsWordStartAt(int pos) const { ++bool Document::IsWordStartAt(Sci::Position pos) const { + if (pos >= Length()) + return false; + if (pos > 0) { +@@ -1777,7 +1777,7 @@ + * Check that the character at the given position is a word or punctuation character and that + * the next character is of a different character class. + */ +-bool Document::IsWordEndAt(int pos) const { ++bool Document::IsWordEndAt(Sci::Position pos) const { + if (pos <= 0) + return false; + if (pos < Length()) { +@@ -1795,11 +1795,11 @@ + * Check that the given range is has transitions between character classes at both + * ends and where the characters on the inside are word or punctuation characters. + */ +-bool Document::IsWordAt(int start, int end) const { ++bool Document::IsWordAt(Sci::Position start, Sci::Position end) const { + return (start < end) && IsWordStartAt(start) && IsWordEndAt(end); + } + +-bool Document::MatchesWordOptions(bool word, bool wordStart, int pos, int length) const { ++bool Document::MatchesWordOptions(bool word, bool wordStart, Sci::Position pos, Sci::Position length) const { + return (!word && !wordStart) || + (word && IsWordAt(pos, pos + length)) || + (wordStart && IsWordStartAt(pos)); +@@ -1814,7 +1814,7 @@ + pcf = pcf_; + } + +-Document::CharacterExtracted Document::ExtractCharacter(int position) const { ++Document::CharacterExtracted Document::ExtractCharacter(Sci::Position position) const { + const unsigned char leadByte = static_cast<unsigned char>(cb.CharAt(position)); + if (UTF8IsAscii(leadByte)) { + // Common case: ASCII character +@@ -1838,8 +1838,8 @@ + * searches (just pass minPos > maxPos to do a backward search) + * Has not been tested with backwards DBCS searches yet. + */ +-long Document::FindText(int minPos, int maxPos, const char *search, +- int flags, int *length) { ++long Document::FindText(Sci::Position minPos, Sci::Position maxPos, const char *search, ++ int flags, Sci::Position *length) { + if (*length <= 0) + return minPos; + const bool caseSensitive = (flags & SCFIND_MATCHCASE) != 0; +@@ -1856,21 +1856,21 @@ + const int increment = forward ? 1 : -1; + + // Range endpoints should not be inside DBCS characters, but just in case, move them. +- const int startPos = MovePositionOutsideChar(minPos, increment, false); +- const int endPos = MovePositionOutsideChar(maxPos, increment, false); ++ const Sci::Position startPos = MovePositionOutsideChar(minPos, increment, false); ++ const Sci::Position endPos = MovePositionOutsideChar(maxPos, increment, false); + + // Compute actual search ranges needed +- const int lengthFind = *length; ++ const Sci::Position lengthFind = *length; + + //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); +- const int limitPos = Platform::Maximum(startPos, endPos); +- int pos = startPos; ++ const Sci::Position limitPos = Platform::Maximum(startPos, endPos); ++ Sci::Position pos = startPos; + if (!forward) { + // Back all of a character + pos = NextPosition(pos, increment); + } + if (caseSensitive) { +- const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos; ++ const Sci::Position endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos; + const char charStartSearch = search[0]; + while (forward ? (pos < endSearch) : (pos >= endSearch)) { + if (CharAt(pos) == charStartSearch) { +@@ -1894,7 +1894,7 @@ + char folded[UTF8MaxBytes * maxFoldingExpansion + 1]; + while (forward ? (pos < endPos) : (pos >= endPos)) { + int widthFirstCharacter = 0; +- int posIndexDocument = pos; ++ Sci::Position posIndexDocument = pos; + int indexSearch = 0; + bool characterMatches = true; + for (;;) { +@@ -1978,7 +1978,7 @@ + break; + } + } else { +- const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos; ++ const Sci::Position endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos; + std::vector<char> searchThing(lengthFind + 1); + pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind); + while (forward ? (pos < endSearch) : (pos >= endSearch)) { +@@ -2001,14 +2001,14 @@ + return -1; + } + +-const char *Document::SubstituteByPosition(const char *text, int *length) { ++const char *Document::SubstituteByPosition(const char *text, Sci::Position *length) { + if (regex) + return regex->SubstituteByPosition(this, text, length); + else + return 0; + } + +-int Document::LinesTotal() const { ++Sci::Line Document::LinesTotal() const { + return cb.Lines(); + } + +@@ -2033,7 +2033,7 @@ + return false; + } else { + enteredStyling++; +- int prevEndStyled = endStyled; ++ Sci::Position prevEndStyled = endStyled; + if (cb.SetStyleFor(endStyled, length, style)) { + DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, + prevEndStyled, length); +@@ -2051,8 +2051,8 @@ + } else { + enteredStyling++; + bool didChange = false; +- int startMod = 0; +- int endMod = 0; ++ Sci::Position startMod = 0; ++ Sci::Position endMod = 0; + for (int iPos = 0; iPos < length; iPos++, endStyled++) { + PLATFORM_ASSERT(endStyled < Length()); + if (cb.SetStyleAt(endStyled, styles[iPos])) { +@@ -2073,12 +2073,12 @@ + } + } + +-void Document::EnsureStyledTo(int pos) { ++void Document::EnsureStyledTo(Sci::Position pos) { + if ((enteredStyling == 0) && (pos > GetEndStyled())) { + IncrementStyleClock(); + if (pli && !pli->UseContainerLexing()) { +- int lineEndStyled = LineFromPosition(GetEndStyled()); +- int endStyledTo = LineStart(lineEndStyled); ++ Sci::Line lineEndStyled = LineFromPosition(GetEndStyled()); ++ Sci::Position endStyledTo = LineStart(lineEndStyled); + pli->Colourise(endStyledTo, pos); + } else { + // Ask the watchers to style, and stop as soon as one responds. +@@ -2090,7 +2090,7 @@ + } + } + +-void Document::StyleToAdjustingLineDuration(int pos) { ++void Document::StyleToAdjustingLineDuration(Sci::Position pos) { + // Place bounds on the duration used to avoid glitches spiking it + // and so causing slow styling or non-responsive scrolling + const double minDurationOneLine = 0.000001; +@@ -2100,11 +2100,11 @@ + // Most recent value contributes 25% to smoothed value. + const double alpha = 0.25; + +- const Sci_Position lineFirst = LineFromPosition(GetEndStyled()); ++ const Sci::Line lineFirst = LineFromPosition(GetEndStyled()); + ElapsedTime etStyling; + EnsureStyledTo(pos); + const double durationStyling = etStyling.Duration(); +- const Sci_Position lineLast = LineFromPosition(GetEndStyled()); ++ const Sci::Line lineLast = LineFromPosition(GetEndStyled()); + if (lineLast >= lineFirst + 8) { + // Only adjust for styling multiple lines to avoid instability + const double durationOneLine = durationStyling / (lineLast - lineFirst); +@@ -2137,7 +2137,7 @@ + return static_cast<LineState *>(perLineData[ldState])->GetLineState(line); + } + +-int Document::GetMaxLineState() { ++Sci::Line Document::GetMaxLineState() { + return static_cast<LineState *>(perLineData[ldState])->GetMaxLineState(); + } + +@@ -2146,45 +2146,45 @@ + NotifyModified(mh); + } + +-StyledText Document::MarginStyledText(int line) const { ++StyledText Document::MarginStyledText(Sci::Line line) const { + LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldMargin]); + return StyledText(pla->Length(line), pla->Text(line), + pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); + } + +-void Document::MarginSetText(int line, const char *text) { ++void Document::MarginSetText(Sci::Line line, const char *text) { + static_cast<LineAnnotation *>(perLineData[ldMargin])->SetText(line, text); + DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); + } + +-void Document::MarginSetStyle(int line, int style) { ++void Document::MarginSetStyle(Sci::Line line, int style) { + static_cast<LineAnnotation *>(perLineData[ldMargin])->SetStyle(line, style); + NotifyModified(DocModification(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line)); + } + +-void Document::MarginSetStyles(int line, const unsigned char *styles) { ++void Document::MarginSetStyles(Sci::Line line, const unsigned char *styles) { + static_cast<LineAnnotation *>(perLineData[ldMargin])->SetStyles(line, styles); + NotifyModified(DocModification(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line)); + } + + void Document::MarginClearAll() { +- int maxEditorLine = LinesTotal(); +- for (int l=0; l<maxEditorLine; l++) ++ Sci::Line maxEditorLine = LinesTotal(); ++ for (Sci::Line l=0; l<maxEditorLine; l++) + MarginSetText(l, 0); + // Free remaining data + static_cast<LineAnnotation *>(perLineData[ldMargin])->ClearAll(); + } + +-StyledText Document::AnnotationStyledText(int line) const { ++StyledText Document::AnnotationStyledText(Sci::Line line) const { + LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldAnnotation]); + return StyledText(pla->Length(line), pla->Text(line), + pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); + } + +-void Document::AnnotationSetText(int line, const char *text) { ++void Document::AnnotationSetText(Sci::Line line, const char *text) { + if (line >= 0 && line < LinesTotal()) { +- const int linesBefore = AnnotationLines(line); ++ const Sci::Line linesBefore = AnnotationLines(line); + static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetText(line, text); + const int linesAfter = AnnotationLines(line); + DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); +@@ -2193,25 +2193,25 @@ + } + } + +-void Document::AnnotationSetStyle(int line, int style) { ++void Document::AnnotationSetStyle(Sci::Line line, int style) { + static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetStyle(line, style); + DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); + } + +-void Document::AnnotationSetStyles(int line, const unsigned char *styles) { ++void Document::AnnotationSetStyles(Sci::Line line, const unsigned char *styles) { + if (line >= 0 && line < LinesTotal()) { + static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetStyles(line, styles); + } + } + +-int Document::AnnotationLines(int line) const { ++int Document::AnnotationLines(Sci::Line line) const { + return static_cast<LineAnnotation *>(perLineData[ldAnnotation])->Lines(line); + } + + void Document::AnnotationClearAll() { +- int maxEditorLine = LinesTotal(); +- for (int l=0; l<maxEditorLine; l++) ++ Sci::Line maxEditorLine = LinesTotal(); ++ for (Sci::Line l=0; l<maxEditorLine; l++) + AnnotationSetText(l, 0); + // Free remaining data + static_cast<LineAnnotation *>(perLineData[ldAnnotation])->ClearAll(); +@@ -2317,7 +2317,7 @@ + return (WordCharacterClass(ch) == CharClassify::ccWord) && IsASCIIPunctuationCharacter(ch); + } + +-int Document::WordPartLeft(int pos) const { ++Sci::Position Document::WordPartLeft(Sci::Position pos) const { + if (pos > 0) { + pos -= CharacterBefore(pos).widthBytes; + CharacterExtracted ceStart = CharacterAfter(pos); +@@ -2367,9 +2367,9 @@ + return pos; + } + +-int Document::WordPartRight(int pos) const { ++Sci::Position Document::WordPartRight(Sci::Position pos) const { + CharacterExtracted ceStart = CharacterAfter(pos); +- const int length = Length(); ++ const Sci::Position length = Length(); + if (IsWordPartSeparator(ceStart.character)) { + while (pos < length && IsWordPartSeparator(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; +@@ -2411,7 +2411,7 @@ + return (c == '\n' || c == '\r'); + } + +-int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { ++Sci::Position Document::ExtendStyleRange(Sci::Position pos, int delta, bool singleLine) { + int sStart = cb.StyleAt(pos); + if (delta < 0) { + while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) +@@ -2448,7 +2448,7 @@ + } + + // TODO: should be able to extend styled region to find matching brace +-int Document::BraceMatch(int position, int /*maxReStyle*/) { ++Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxReStyle*/) { + char chBrace = CharAt(position); + char chSeek = BraceOpposite(chBrace); + if (chSeek == '\0') +@@ -2470,7 +2470,7 @@ + if (depth == 0) + return position; + } +- int positionBeforeMove = position; ++ Sci::Position positionBeforeMove = position; + position = NextPosition(position, direction); + if (position == positionBeforeMove) + break; +@@ -2488,11 +2488,11 @@ + virtual ~BuiltinRegex() { + } + +- virtual long FindText(Document *doc, int minPos, int maxPos, const char *s, ++ virtual long FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, + bool caseSensitive, bool word, bool wordStart, int flags, +- int *length); ++ Sci::Position *length); + +- virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length); ++ virtual const char *SubstituteByPosition(Document *doc, const char *text, Sci::Position *length); + + private: + RESearch search; +@@ -2508,12 +2508,12 @@ + public: + const Document *doc; + int increment; +- int startPos; +- int endPos; +- int lineRangeStart; +- int lineRangeEnd; +- int lineRangeBreak; +- RESearchRange(const Document *doc_, int minPos, int maxPos) : doc(doc_) { ++ Sci::Position startPos; ++ Sci::Position endPos; ++ Sci::Line lineRangeStart; ++ Sci::Line lineRangeEnd; ++ Sci::Line lineRangeBreak; ++ RESearchRange(const Document *doc_, Sci::Position minPos, Sci::Position maxPos) : doc(doc_) { + increment = (minPos <= maxPos) ? 1 : -1; + + // Range endpoints should not be inside DBCS characters, but just in case, move them. +@@ -2537,7 +2537,7 @@ + } + lineRangeBreak = lineRangeEnd + increment; + } +- Range LineRange(int line) const { ++ Range LineRange(Sci::Line line) const { + Range range(doc->LineStart(line), doc->LineEnd(line)); + if (increment == 1) { + if (line == lineRangeStart) +@@ -2557,16 +2557,16 @@ + // Define a way for the Regular Expression code to access the document + class DocumentIndexer : public CharacterIndexer { + Document *pdoc; +- int end; ++ Sci::Position end; + public: +- DocumentIndexer(Document *pdoc_, int end_) : ++ DocumentIndexer(Document *pdoc_, Sci::Position end_) : + pdoc(pdoc_), end(end_) { + } + + virtual ~DocumentIndexer() { + } + +- virtual char CharAt(int index) { ++ virtual char CharAt(Sci::Position index) { + if (index < 0 || index >= end) + return 0; + else +@@ -2579,8 +2579,8 @@ + class ByteIterator : public std::iterator<std::bidirectional_iterator_tag, char> { + public: + const Document *doc; +- Position position; +- ByteIterator(const Document *doc_ = 0, Position position_ = 0) : doc(doc_), position(position_) { ++ Sci::Position position; ++ ByteIterator(const Document *doc_ = 0, Sci::Position position_ = 0) : doc(doc_), position(position_) { + } + ByteIterator(const ByteIterator &other) NOEXCEPT { + doc = other.doc; +@@ -2615,10 +2615,10 @@ + bool operator!=(const ByteIterator &other) const { + return doc != other.doc || position != other.position; + } +- int Pos() const { ++ Sci::Position Pos() const { + return position; + } +- int PosRoundUp() const { ++ Sci::Position PosRoundUp() const { + return position; + } + }; +@@ -2642,14 +2642,14 @@ + class UTF8Iterator : public std::iterator<std::bidirectional_iterator_tag, wchar_t> { + // These 3 fields determine the iterator position and are used for comparisons + const Document *doc; +- Position position; ++ Sci::Position position; + size_t characterIndex; + // Remaining fields are derived from the determining fields so are excluded in comparisons + unsigned int lenBytes; + size_t lenCharacters; + wchar_t buffered[2]; + public: +- UTF8Iterator(const Document *doc_ = 0, Position position_ = 0) : ++ UTF8Iterator(const Document *doc_ = 0, Sci::Position position_ = 0) : + doc(doc_), position(position_), characterIndex(0), lenBytes(0), lenCharacters(0) { + buffered[0] = 0; + buffered[1] = 0; +@@ -2725,10 +2725,10 @@ + position != other.position || + characterIndex != other.characterIndex; + } +- int Pos() const { ++ Sci::Position Pos() const { + return position; + } +- int PosRoundUp() const { ++ Sci::Position PosRoundUp() const { + if (characterIndex) + return position + lenBytes; // Force to end of character + else +@@ -2753,9 +2753,9 @@ + + class UTF8Iterator : public std::iterator<std::bidirectional_iterator_tag, wchar_t> { + const Document *doc; +- Position position; ++ Sci::Position position; + public: +- UTF8Iterator(const Document *doc_=0, Position position_=0) : doc(doc_), position(position_) { ++ UTF8Iterator(const Document *doc_=0, Sci::Position position_=0) : doc(doc_), position(position_) { + } + UTF8Iterator(const UTF8Iterator &other) NOEXCEPT { + doc = other.doc; +@@ -2791,17 +2791,17 @@ + bool operator!=(const UTF8Iterator &other) const { + return doc != other.doc || position != other.position; + } +- int Pos() const { ++ Sci::Position Pos() const { + return position; + } +- int PosRoundUp() const { ++ Sci::Position PosRoundUp() const { + return position; + } + }; + + #endif + +-std::regex_constants::match_flag_type MatchFlags(const Document *doc, int startPos, int endPos) { ++std::regex_constants::match_flag_type MatchFlags(const Document *doc, Sci::Position startPos, Sci::Position endPos) { + std::regex_constants::match_flag_type flagsMatch = std::regex_constants::match_default; + if (!doc->IsLineStartPosition(startPos)) + flagsMatch |= std::regex_constants::match_not_bol; +@@ -2824,7 +2824,7 @@ + // matched = std::regex_search(uiStart, uiEnd, match, regexp, flagsMatch); + + // Line by line. +- for (int line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) { ++ for (Sci::Line line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) { + const Range lineRange = resr.LineRange(line); + Iterator itStart(doc, lineRange.start); + Iterator itEnd(doc, lineRange.end); +@@ -2865,8 +2865,8 @@ + return matched; + } + +-long Cxx11RegexFindText(Document *doc, int minPos, int maxPos, const char *s, +- bool caseSensitive, int *length, RESearch &search) { ++Sci::Position Cxx11RegexFindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, ++ bool caseSensitive, Sci::Position *length, RESearch &search) { + const RESearchRange resr(doc, minPos, maxPos); + try { + //ElapsedTime et; +@@ -2906,7 +2906,7 @@ + matched = MatchOnLines<ByteIterator>(doc, regexp, resr, search); + } + +- int posMatch = -1; ++ Sci::Position posMatch = -1; + if (matched) { + posMatch = search.bopat[0]; + *length = search.eopat[0] - search.bopat[0]; +@@ -2930,9 +2930,9 @@ + + } + +-long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s, ++long BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, + bool caseSensitive, bool, bool, int flags, +- int *length) { ++ Sci::Position *length) { + + #ifndef NO_CXX11_REGEX + if (flags & SCFIND_CXX11REGEX) { +@@ -2953,13 +2953,13 @@ + // Replace first '.' with '-' in each property file variable reference: + // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\)) + // Replace: $(\1-\2) +- int pos = -1; +- int lenRet = 0; ++ Sci::Position pos = -1; ++ Sci::Position lenRet = 0; + const char searchEnd = s[*length - 1]; + const char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0'; +- for (int line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) { +- int startOfLine = doc->LineStart(line); +- int endOfLine = doc->LineEnd(line); ++ for (Sci::Line line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) { ++ Sci::Position startOfLine = doc->LineStart(line); ++ Sci::Position endOfLine = doc->LineEnd(line); + if (resr.increment == 1) { + if (line == resr.lineRangeStart) { + if ((resr.startPos != startOfLine) && (s[0] == '^')) +@@ -3014,7 +3014,7 @@ + return pos; + } + +-const char *BuiltinRegex::SubstituteByPosition(Document *doc, const char *text, int *length) { ++const char *BuiltinRegex::SubstituteByPosition(Document *doc, const char *text, Sci::Position *length) { + substituted.clear(); + DocumentIndexer di(doc, doc->Length()); + search.GrabMatches(di); +@@ -3022,7 +3022,7 @@ + if (text[j] == '\\') { + if (text[j + 1] >= '0' && text[j + 1] <= '9') { + unsigned int patNum = text[j + 1] - '0'; +- unsigned int len = search.eopat[patNum] - search.bopat[patNum]; ++ Sci::Position len = search.eopat[patNum] - search.bopat[patNum]; + if (!search.pat[patNum].empty()) // Will be null if try for a match that did not occur + substituted.append(search.pat[patNum].c_str(), len); + j++; +diff -r 1788f6795302 -r a0f26eaf474d src/Document.h +--- a/src/Document.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/Document.h Fri Mar 31 18:19:38 2017 +1100 +@@ -12,13 +12,6 @@ + namespace Scintilla { + #endif + +-/** +- * A Position is a position within a document between two characters or at the beginning or end. +- * Sometimes used as a character index where it identifies the character after the position. +- */ +-typedef int Position; +-const Position invalidPosition = -1; +- + enum EncodingFamily { efEightBit, efUnicode, efDBCS }; + + /** +@@ -29,13 +22,13 @@ + */ + class Range { + public: +- Position start; +- Position end; ++ Sci::Position start; ++ Sci::Position end; + +- explicit Range(Position pos=0) : ++ explicit Range(Sci::Position pos=0) : + start(pos), end(pos) { + } +- Range(Position start_, Position end_) : ++ Range(Sci::Position start_, Sci::Position end_) : + start(start_), end(end_) { + } + +@@ -44,19 +37,19 @@ + } + + bool Valid() const { +- return (start != invalidPosition) && (end != invalidPosition); ++ return (start != Sci::invalidPosition) && (end != Sci::invalidPosition); + } + +- Position First() const { ++ Sci::Position First() const { + return (start <= end) ? start : end; + } + +- Position Last() const { ++ Sci::Position Last() const { + return (start > end) ? start : end; + } + + // Is the position within the range? +- bool Contains(Position pos) const { ++ bool Contains(Sci::Position pos) const { + if (start < end) { + return (pos >= start && pos <= end); + } else { +@@ -65,7 +58,7 @@ + } + + // Is the character after pos within the range? +- bool ContainsCharacter(Position pos) const { ++ bool ContainsCharacter(Sci::Position pos) const { + if (start < end) { + return (pos >= start && pos < end); + } else { +@@ -97,11 +90,11 @@ + public: + virtual ~RegexSearchBase() {} + +- virtual long FindText(Document *doc, int minPos, int maxPos, const char *s, +- bool caseSensitive, bool word, bool wordStart, int flags, int *length) = 0; ++ virtual long FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, ++ bool caseSensitive, bool word, bool wordStart, int flags, Sci::Position *length) = 0; + + ///@return String with the substitutions, must remain valid until the next call or destruction +- virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length) = 0; ++ virtual const char *SubstituteByPosition(Document *doc, const char *text, Sci::Position *length) = 0; + }; + + /// Factory function for RegexSearchBase +@@ -142,30 +135,30 @@ + firstChangeableLineAfter = -1; + } + +- bool NeedsDrawing(int line) const { ++ bool NeedsDrawing(Sci::Line line) const { + return isEnabled && (line <= firstChangeableLineBefore || line >= firstChangeableLineAfter); + } + +- bool IsFoldBlockHighlighted(int line) const { ++ bool IsFoldBlockHighlighted(Sci::Line line) const { + return isEnabled && beginFoldBlock != -1 && beginFoldBlock <= line && line <= endFoldBlock; + } + +- bool IsHeadOfFoldBlock(int line) const { ++ bool IsHeadOfFoldBlock(Sci::Line line) const { + return beginFoldBlock == line && line < endFoldBlock; + } + +- bool IsBodyOfFoldBlock(int line) const { ++ bool IsBodyOfFoldBlock(Sci::Line line) const { + return beginFoldBlock != -1 && beginFoldBlock < line && line < endFoldBlock; + } + +- bool IsTailOfFoldBlock(int line) const { ++ bool IsTailOfFoldBlock(Sci::Line line) const { + return beginFoldBlock != -1 && beginFoldBlock < line && line == endFoldBlock; + } + +- int beginFoldBlock; // Begin of current fold block +- int endFoldBlock; // End of current fold block +- int firstChangeableLineBefore; // First line that triggers repaint before starting line that determined current fold block +- int firstChangeableLineAfter; // First line that triggers repaint after starting line that determined current fold block ++ Sci::Line beginFoldBlock; // Begin of current fold block ++ Sci::Line endFoldBlock; // End of current fold block ++ Sci::Line firstChangeableLineBefore; // First line that triggers repaint before starting line that determined current fold block ++ Sci::Line firstChangeableLineAfter; // First line that triggers repaint after starting line that determined current fold block + bool isEnabled; + }; + +@@ -185,7 +178,7 @@ + } + virtual ~LexInterface() { + } +- void Colourise(int start, int end); ++ void Colourise(Sci::Position start, Sci::Position end); + int LineEndTypesSupported(); + bool UseContainerLexing() const { + return instance == 0; +@@ -218,7 +211,7 @@ + CellBuffer cb; + CharClassify charClass; + CaseFolder *pcf; +- int endStyled; ++ Sci::Position endStyled; + int styleClock; + int enteredModification; + int enteredStyling; +@@ -278,8 +271,8 @@ + int GetLineEndTypesAllowed() const { return cb.GetLineEndTypes(); } + bool SetLineEndTypesAllowed(int lineEndBitSet_); + int GetLineEndTypesActive() const { return cb.GetLineEndTypes(); } +- virtual void InsertLine(int line); +- virtual void RemoveLine(int line); ++ virtual void InsertLine(Sci::Line line); ++ virtual void RemoveLine(Sci::Line line); + + int SCI_METHOD Version() const { + return dvLineEnd; +@@ -288,18 +281,18 @@ + void SCI_METHOD SetErrorStatus(int status); + + Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const; +- int ClampPositionIntoDocument(int pos) const; +- bool ContainsLineEnd(const char *s, int length) const { return cb.ContainsLineEnd(s, length); } +- bool IsCrLf(int pos) const; +- int LenChar(int pos); +- bool InGoodUTF8(int pos, int &start, int &end) const; +- int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; +- int NextPosition(int pos, int moveDir) const; +- bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed +- Document::CharacterExtracted CharacterAfter(int position) const; +- Document::CharacterExtracted CharacterBefore(int position) const; ++ Sci::Position ClampPositionIntoDocument(Sci::Position pos) const; ++ bool ContainsLineEnd(const char *s, Sci::Position length) const { return cb.ContainsLineEnd(s, length); } ++ bool IsCrLf(Sci::Position pos) const; ++ int LenChar(Sci::Position pos); ++ bool InGoodUTF8(Sci::Position pos, Sci::Position &start, Sci::Position &end) const; ++ Sci::Position MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd=true) const; ++ Sci::Position NextPosition(Sci::Position pos, int moveDir) const; ++ bool NextCharacter(Sci::Position &pos, int moveDir) const; // Returns true if pos changed ++ Document::CharacterExtracted CharacterAfter(Sci::Position position) const; ++ Document::CharacterExtracted CharacterBefore(Sci::Position position) const; + Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const; +- int GetRelativePositionUTF16(int positionStart, int characterOffset) const; ++ Sci::Position GetRelativePositionUTF16(Sci::Position positionStart, Sci::Position characterOffset) const; + int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const; + int SCI_METHOD CodePage() const; + bool SCI_METHOD IsDBCSLeadByte(char ch) const; +@@ -307,15 +300,15 @@ + EncodingFamily CodePageFamily() const; + + // Gateways to modifying document +- void ModifiedAt(int pos); ++ void ModifiedAt(Sci::Position pos); + void CheckReadOnly(); +- bool DeleteChars(int pos, int len); +- int InsertString(int position, const char *s, int insertLength); +- void ChangeInsertion(const char *s, int length); ++ bool DeleteChars(Sci::Position pos, Sci::Position len); ++ Sci::Position InsertString(Sci::Position position, const char *s, Sci::Position insertLength); ++ void ChangeInsertion(const char *s, Sci::Position length); + int SCI_METHOD AddData(char *data, Sci_Position length); + void * SCI_METHOD ConvertToDocument(); +- int Undo(); +- int Redo(); ++ Sci::Position Undo(); ++ Sci::Position Redo(); + bool CanUndo() const { return cb.CanUndo(); } + bool CanRedo() const { return cb.CanRedo(); } + void DeleteUndoHistory() { cb.DeleteUndoHistory(); } +@@ -325,7 +318,7 @@ + bool IsCollectingUndo() const { return cb.IsCollectingUndo(); } + void BeginUndoAction() { cb.BeginUndoAction(); } + void EndUndoAction() { cb.EndUndoAction(); } +- void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); } ++ void AddUndoAction(Sci::Position token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); } + void SetSavePoint(); + bool IsSavePoint() const { return cb.IsSavePoint(); } + +@@ -335,76 +328,76 @@ + bool TentativeActive() const { return cb.TentativeActive(); } + + const char * SCI_METHOD BufferPointer() { return cb.BufferPointer(); } +- const char *RangePointer(int position, int rangeLength) { return cb.RangePointer(position, rangeLength); } +- int GapPosition() const { return cb.GapPosition(); } ++ const char *RangePointer(Sci::Position position, Sci::Position rangeLength) { return cb.RangePointer(position, rangeLength); } ++ Sci::Position GapPosition() const { return cb.GapPosition(); } + + int SCI_METHOD GetLineIndentation(Sci_Position line); +- int SetLineIndentation(int line, int indent); +- int GetLineIndentPosition(int line) const; +- int GetColumn(int position); +- int CountCharacters(int startPos, int endPos) const; +- int CountUTF16(int startPos, int endPos) const; +- int FindColumn(int line, int column); +- void Indent(bool forwards, int lineBottom, int lineTop); ++ Sci::Position SetLineIndentation(Sci::Line line, Sci::Position indent); ++ Sci::Position GetLineIndentPosition(Sci::Line line) const; ++ Sci::Position GetColumn(Sci::Position position); ++ Sci::Position CountCharacters(Sci::Position startPos, Sci::Position endPos) const; ++ Sci::Position CountUTF16(Sci::Position startPos, Sci::Position endPos) const; ++ Sci::Position FindColumn(Sci::Line line, Sci::Position column); ++ void Indent(bool forwards, Sci::Line lineBottom, Sci::Line lineTop); + static std::string TransformLineEnds(const char *s, size_t len, int eolModeWanted); + void ConvertLineEnds(int eolModeSet); + void SetReadOnly(bool set) { cb.SetReadOnly(set); } + bool IsReadOnly() const { return cb.IsReadOnly(); } + +- void DelChar(int pos); +- void DelCharBack(int pos); ++ void DelChar(Sci::Position pos); ++ void DelCharBack(Sci::Position pos); + +- char CharAt(int position) const { return cb.CharAt(position); } ++ char CharAt(Sci::Position position) const { return cb.CharAt(position); } + void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const { + cb.GetCharRange(buffer, position, lengthRetrieve); + } + char SCI_METHOD StyleAt(Sci_Position position) const { return cb.StyleAt(position); } + int StyleIndexAt(Sci_Position position) const { return static_cast<unsigned char>(cb.StyleAt(position)); } +- void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const { ++ void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const { + cb.GetStyleRange(buffer, position, lengthRetrieve); + } +- int GetMark(int line); +- int MarkerNext(int lineStart, int mask) const; +- int AddMark(int line, int markerNum); +- void AddMarkSet(int line, int valueSet); +- void DeleteMark(int line, int markerNum); ++ int GetMark(Sci::Line line); ++ Sci::Line MarkerNext(Sci::Line lineStart, int mask) const; ++ int AddMark(Sci::Line line, int markerNum); ++ void AddMarkSet(Sci::Line line, int valueSet); ++ void DeleteMark(Sci::Line line, int markerNum); + void DeleteMarkFromHandle(int markerHandle); + void DeleteAllMarks(int markerNum); +- int LineFromHandle(int markerHandle); ++ Sci::Line LineFromHandle(int markerHandle); + Sci_Position SCI_METHOD LineStart(Sci_Position line) const; +- bool IsLineStartPosition(int position) const; ++ bool IsLineStartPosition(Sci::Position position) const; + Sci_Position SCI_METHOD LineEnd(Sci_Position line) const; +- int LineEndPosition(int position) const; +- bool IsLineEndPosition(int position) const; +- bool IsPositionInLineEnd(int position) const; +- int VCHomePosition(int position) const; ++ Sci::Position LineEndPosition(Sci::Position position) const; ++ bool IsLineEndPosition(Sci::Position position) const; ++ bool IsPositionInLineEnd(Sci::Position position) const; ++ Sci::Position VCHomePosition(Sci::Position position) const; + + int SCI_METHOD SetLevel(Sci_Position line, int level); + int SCI_METHOD GetLevel(Sci_Position line) const; + void ClearLevels(); +- int GetLastChild(int lineParent, int level=-1, int lastLine=-1); +- int GetFoldParent(int line) const; +- void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int lastLine); ++ Sci::Line GetLastChild(Sci::Line lineParent, int level=-1, Sci::Line lastLine=-1); ++ Sci::Line GetFoldParent(Sci::Line line) const; ++ void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, Sci::Line line, Sci::Line lastLine); + + void Indent(bool forwards); +- int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false) const; +- int NextWordStart(int pos, int delta) const; +- int NextWordEnd(int pos, int delta) const; ++ Sci::Position ExtendWordSelect(Sci::Position pos, int delta, bool onlyWordCharacters=false) const; ++ Sci::Position NextWordStart(Sci::Position pos, int delta) const; ++ Sci::Position NextWordEnd(Sci::Position pos, int delta) const; + Sci_Position SCI_METHOD Length() const { return cb.Length(); } +- void Allocate(int newSize) { cb.Allocate(newSize); } ++ void Allocate(Sci::Position newSize) { cb.Allocate(newSize); } + +- CharacterExtracted ExtractCharacter(int position) const; ++ CharacterExtracted ExtractCharacter(Sci::Position position) const; + +- bool IsWordStartAt(int pos) const; +- bool IsWordEndAt(int pos) const; +- bool IsWordAt(int start, int end) const; ++ bool IsWordStartAt(Sci::Position pos) const; ++ bool IsWordEndAt(Sci::Position pos) const; ++ bool IsWordAt(Sci::Position start, Sci::Position end) const; + +- bool MatchesWordOptions(bool word, bool wordStart, int pos, int length) const; ++ bool MatchesWordOptions(bool word, bool wordStart, Sci::Position pos, Sci::Position length) const; + bool HasCaseFolder() const; + void SetCaseFolder(CaseFolder *pcf_); +- long FindText(int minPos, int maxPos, const char *search, int flags, int *length); +- const char *SubstituteByPosition(const char *text, int *length); +- int LinesTotal() const; ++ long FindText(Sci::Position minPos, Sci::Position maxPos, const char *search, int flags, Sci::Position *length); ++ const char *SubstituteByPosition(const char *text, Sci::Position *length); ++ Sci::Line LinesTotal() const; + + void SetDefaultCharClasses(bool includeWordClass); + void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass); +@@ -412,9 +405,9 @@ + void SCI_METHOD StartStyling(Sci_Position position, char mask); + bool SCI_METHOD SetStyleFor(Sci_Position length, char style); + bool SCI_METHOD SetStyles(Sci_Position length, const char *styles); +- int GetEndStyled() const { return endStyled; } +- void EnsureStyledTo(int pos); +- void StyleToAdjustingLineDuration(int pos); ++ Sci::Position GetEndStyled() const { return endStyled; } ++ void EnsureStyledTo(Sci::Position pos); ++ void StyleToAdjustingLineDuration(Sci::Position pos); + void LexerChanged(); + int GetStyleClock() const { return styleClock; } + void IncrementStyleClock(); +@@ -425,20 +418,20 @@ + + int SCI_METHOD SetLineState(Sci_Position line, int state); + int SCI_METHOD GetLineState(Sci_Position line) const; +- int GetMaxLineState(); ++ Sci::Line GetMaxLineState(); + void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end); + +- StyledText MarginStyledText(int line) const; +- void MarginSetStyle(int line, int style); +- void MarginSetStyles(int line, const unsigned char *styles); +- void MarginSetText(int line, const char *text); ++ StyledText MarginStyledText(Sci::Line line) const; ++ void MarginSetStyle(Sci::Line line, int style); ++ void MarginSetStyles(Sci::Line line, const unsigned char *styles); ++ void MarginSetText(Sci::Line line, const char *text); + void MarginClearAll(); + +- StyledText AnnotationStyledText(int line) const; +- void AnnotationSetText(int line, const char *text); +- void AnnotationSetStyle(int line, int style); +- void AnnotationSetStyles(int line, const unsigned char *styles); +- int AnnotationLines(int line) const; ++ StyledText AnnotationStyledText(Sci::Line line) const; ++ void AnnotationSetText(Sci::Line line, const char *text); ++ void AnnotationSetStyle(Sci::Line line, int style); ++ void AnnotationSetStyles(Sci::Line line, const unsigned char *styles); ++ int AnnotationLines(Sci::Line line) const; + void AnnotationClearAll(); + + bool AddWatcher(DocWatcher *watcher, void *userData); +@@ -447,14 +440,14 @@ + bool IsASCIIWordByte(unsigned char ch) const; + CharClassify::cc WordCharacterClass(unsigned int ch) const; + bool IsWordPartSeparator(unsigned int ch) const; +- int WordPartLeft(int pos) const; +- int WordPartRight(int pos) const; +- int ExtendStyleRange(int pos, int delta, bool singleLine = false); +- bool IsWhiteLine(int line) const; +- int ParaUp(int pos) const; +- int ParaDown(int pos) const; ++ Sci::Position WordPartLeft(Sci::Position pos) const; ++ Sci::Position WordPartRight(Sci::Position pos) const; ++ Sci::Position ExtendStyleRange(Sci::Position pos, int delta, bool singleLine = false); ++ bool IsWhiteLine(Sci::Line line) const; ++ Sci::Position ParaUp(Sci::Position pos) const; ++ Sci::Position ParaDown(Sci::Position pos) const; + int IndentSize() const { return actualIndentInChars; } +- int BraceMatch(int position, int maxReStyle); ++ Sci::Position BraceMatch(Sci::Position position, Sci::Position maxReStyle); + + private: + void NotifyModifyAttempt(); +@@ -491,18 +484,18 @@ + class DocModification { + public: + int modificationType; +- int position; +- int length; +- int linesAdded; /**< Negative if lines deleted. */ ++ Sci::Position position; ++ Sci::Position length; ++ Sci::Line linesAdded; /**< Negative if lines deleted. */ + const char *text; /**< Only valid for changes to text, not for changes to style. */ +- int line; ++ Sci::Line line; + int foldLevelNow; + int foldLevelPrev; +- int annotationLinesAdded; +- int token; ++ Sci::Line annotationLinesAdded; ++ Sci::Position token; + +- DocModification(int modificationType_, int position_=0, int length_=0, +- int linesAdded_=0, const char *text_=0, int line_=0) : ++ DocModification(int modificationType_, Sci::Position position_=0, Sci::Position length_=0, ++ Sci::Line linesAdded_=0, const char *text_=0, Sci::Line line_=0) : + modificationType(modificationType_), + position(position_), + length(length_), +@@ -514,7 +507,7 @@ + annotationLinesAdded(0), + token(0) {} + +- DocModification(int modificationType_, const Action &act, int linesAdded_=0) : ++ DocModification(int modificationType_, const Action &act, Sci::Line linesAdded_=0) : + modificationType(modificationType_), + position(act.position), + length(act.lenData), +@@ -539,7 +532,7 @@ + virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0; + virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0; + virtual void NotifyDeleted(Document *doc, void *userData) = 0; +- virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0; ++ virtual void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos) = 0; + virtual void NotifyLexerChanged(Document *doc, void *userData) = 0; + virtual void NotifyErrorOccurred(Document *doc, void *userData, int status) = 0; + }; +diff -r 1788f6795302 -r a0f26eaf474d src/EditModel.cxx +--- a/src/EditModel.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/EditModel.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -57,17 +57,17 @@ + inOverstrike = false; + xOffset = 0; + trackLineWidth = false; +- posDrag = SelectionPosition(invalidPosition); +- braces[0] = invalidPosition; +- braces[1] = invalidPosition; ++ posDrag = SelectionPosition(Sci::invalidPosition); ++ braces[0] = Sci::invalidPosition; ++ braces[1] = Sci::invalidPosition; + bracesMatchStyle = STYLE_BRACEBAD; + highlightGuideColumn = 0; + primarySelection = true; + imeInteraction = imeWindowed; + foldFlags = 0; + foldDisplayTextStyle = SC_FOLDDISPLAYTEXT_HIDDEN; +- hotspot = Range(invalidPosition); +- hoverIndicatorPos = invalidPosition; ++ hotspot = Range(Sci::invalidPosition); ++ hoverIndicatorPos = Sci::invalidPosition; + wrapWidth = LineLayout::wrapWidthInfinite; + pdoc = new Document(); + pdoc->AddRef(); +diff -r 1788f6795302 -r a0f26eaf474d src/EditModel.h +--- a/src/EditModel.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/EditModel.h Fri Mar 31 18:19:38 2017 +1100 +@@ -36,7 +36,7 @@ + SpecialRepresentations reprs; + Caret caret; + SelectionPosition posDrag; +- Position braces[2]; ++ Sci::Position braces[2]; + int bracesMatchStyle; + int highlightGuideColumn; + Selection sel; +@@ -49,7 +49,7 @@ + ContractionState cs; + // Hotspot support + Range hotspot; +- int hoverIndicatorPos; ++ Sci::Position hoverIndicatorPos; + + // Wrapping support + int wrapWidth; +@@ -58,9 +58,9 @@ + + EditModel(); + virtual ~EditModel(); +- virtual int TopLineOfMain() const = 0; ++ virtual Sci::Line TopLineOfMain() const = 0; + virtual Point GetVisibleOriginInMain() const = 0; +- virtual int LinesOnScreen() const = 0; ++ virtual Sci::Line LinesOnScreen() const = 0; + virtual Range GetHotSpotRange() const = 0; + }; + +diff -r 1788f6795302 -r a0f26eaf474d src/EditView.cxx +--- a/src/EditView.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/EditView.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -222,19 +222,19 @@ + ldTabstops = 0; + } + +-XYPOSITION EditView::NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const { ++XYPOSITION EditView::NextTabstopPos(Sci::Line line, XYPOSITION x, XYPOSITION tabWidth) const { + int next = GetNextTabstop(line, static_cast<int>(x + tabWidthMinimumPixels)); + if (next > 0) + return static_cast<XYPOSITION>(next); + return (static_cast<int>((x + tabWidthMinimumPixels) / tabWidth) + 1) * tabWidth; + } + +-bool EditView::ClearTabstops(int line) { ++bool EditView::ClearTabstops(Sci::Line line) { + LineTabstops *lt = static_cast<LineTabstops *>(ldTabstops); + return lt && lt->ClearTabstops(line); + } + +-bool EditView::AddTabstop(int line, int x) { ++bool EditView::AddTabstop(Sci::Line line, int x) { + if (!ldTabstops) { + ldTabstops = new LineTabstops(); + } +@@ -242,7 +242,7 @@ + return lt && lt->AddTabstop(line, x); + } + +-int EditView::GetNextTabstop(int line, int x) const { ++int EditView::GetNextTabstop(Sci::Line line, int x) const { + LineTabstops *lt = static_cast<LineTabstops *>(ldTabstops); + if (lt) { + return lt->GetNextTabstop(line, x); +@@ -251,14 +251,14 @@ + } + } + +-void EditView::LinesAddedOrRemoved(int lineOfPos, int linesAdded) { ++void EditView::LinesAddedOrRemoved(Sci::Line lineOfPos, Sci::Line linesAdded) { + if (ldTabstops) { + if (linesAdded > 0) { +- for (int line = lineOfPos; line < lineOfPos + linesAdded; line++) { ++ for (Sci::Line line = lineOfPos; line < lineOfPos + linesAdded; line++) { + ldTabstops->InsertLine(line); + } + } else { +- for (int line = (lineOfPos + -linesAdded) - 1; line >= lineOfPos; line--) { ++ for (Sci::Line line = (lineOfPos + -linesAdded) - 1; line >= lineOfPos; line--) { + ldTabstops->RemoveLine(line); + } + } +@@ -345,11 +345,11 @@ + } + } + +-LineLayout *EditView::RetrieveLineLayout(int lineNumber, const EditModel &model) { +- int posLineStart = model.pdoc->LineStart(lineNumber); +- int posLineEnd = model.pdoc->LineStart(lineNumber + 1); ++LineLayout *EditView::RetrieveLineLayout(Sci::Line lineNumber, const EditModel &model) { ++ Sci::Position posLineStart = model.pdoc->LineStart(lineNumber); ++ Sci::Position posLineEnd = model.pdoc->LineStart(lineNumber + 1); + PLATFORM_ASSERT(posLineEnd >= posLineStart); +- int lineCaret = model.pdoc->LineFromPosition(model.sel.MainCaret()); ++ Sci::Line lineCaret = model.pdoc->LineFromPosition(model.sel.MainCaret()); + return llc.Retrieve(lineNumber, lineCaret, + posLineEnd - posLineStart, model.pdoc->GetStyleClock(), + model.LinesOnScreen() + 1, model.pdoc->LinesTotal()); +@@ -360,20 +360,20 @@ + * Copy the given @a line and its styles from the document into local arrays. + * Also determine the x position at which each character starts. + */ +-void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, const ViewStyle &vstyle, LineLayout *ll, int width) { ++void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surface, const ViewStyle &vstyle, LineLayout *ll, int width) { + if (!ll) + return; + + PLATFORM_ASSERT(line < model.pdoc->LinesTotal()); + PLATFORM_ASSERT(ll->chars != NULL); +- int posLineStart = model.pdoc->LineStart(line); +- int posLineEnd = model.pdoc->LineStart(line + 1); ++ Sci::Position posLineStart = model.pdoc->LineStart(line); ++ Sci::Position posLineEnd = model.pdoc->LineStart(line + 1); + // If the line is very long, limit the treatment to a length that should fit in the viewport + if (posLineEnd >(posLineStart + ll->maxLineLength)) { + posLineEnd = posLineStart + ll->maxLineLength; + } + if (ll->validity == LineLayout::llCheckTextAndStyle) { +- int lineLength = posLineEnd - posLineStart; ++ Sci::Position lineLength = posLineEnd - posLineStart; + if (!vstyle.viewEOL) { + lineLength = model.pdoc->LineEnd(line) - posLineStart; + } +@@ -384,7 +384,7 @@ + int styleByte = 0; + int numCharsInLine = 0; + while (numCharsInLine < lineLength) { +- int charInDoc = numCharsInLine + posLineStart; ++ Sci::Position charInDoc = numCharsInLine + posLineStart; + char chDoc = model.pdoc->CharAt(charInDoc); + styleByte = model.pdoc->StyleIndexAt(charInDoc); + allSame = allSame && +@@ -436,7 +436,7 @@ + model.pdoc->GetStyleRange(ll->styles, posLineStart, lineLength); + int numCharsBeforeEOL = model.pdoc->LineEnd(line) - posLineStart; + const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL; +- for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) { ++ for (Sci::Position styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) { + const unsigned char styleByte = ll->styles[styleInLine]; + ll->styles[styleInLine] = styleByte; + } +@@ -503,7 +503,7 @@ + lastSegItalics = (!ts.representation) && ((ll->chars[ts.end() - 1] != ' ') && vstyle.styles[ll->styles[ts.start]].italic); + } + +- for (int posToIncrease = ts.start + 1; posToIncrease <= ts.end(); posToIncrease++) { ++ for (Sci::Position posToIncrease = ts.start + 1; posToIncrease <= ts.end(); posToIncrease++) { + ll->positions[posToIncrease] += ll->positions[ts.start]; + } + } +@@ -600,19 +600,19 @@ + } + } + +-Point EditView::LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, int topLine, ++Point EditView::LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, Sci::Line topLine, + const ViewStyle &vs, PointEnd pe) { + Point pt; + if (pos.Position() == INVALID_POSITION) + return pt; +- int lineDoc = model.pdoc->LineFromPosition(pos.Position()); +- int posLineStart = model.pdoc->LineStart(lineDoc); ++ Sci::Line lineDoc = model.pdoc->LineFromPosition(pos.Position()); ++ Sci::Position posLineStart = model.pdoc->LineStart(lineDoc); + if ((pe & peLineEnd) && (lineDoc > 0) && (pos.Position() == posLineStart)) { + // Want point at end of first line + lineDoc--; + posLineStart = model.pdoc->LineStart(lineDoc); + } +- const int lineVisible = model.cs.DisplayFromDoc(lineDoc); ++ const Sci::Line lineVisible = model.cs.DisplayFromDoc(lineDoc); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); + if (surface && ll) { + LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); +@@ -625,17 +625,17 @@ + return pt; + } + +-Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, int lineVisible, const ViewStyle &vs) { ++Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, Sci::Line lineVisible, const ViewStyle &vs) { + Range rangeSubLine = Range(0,0); + if (lineVisible < 0) { + return rangeSubLine; + } +- const int lineDoc = model.cs.DocFromDisplay(lineVisible); +- const int positionLineStart = model.pdoc->LineStart(lineDoc); ++ const Sci::Line lineDoc = model.cs.DocFromDisplay(lineVisible); ++ const Sci::Position positionLineStart = model.pdoc->LineStart(lineDoc); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); + if (surface && ll) { + LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); +- const int lineStartSet = model.cs.DisplayFromDoc(lineDoc); ++ const Sci::Line lineStartSet = model.cs.DisplayFromDoc(lineDoc); + const int subLine = lineVisible - lineStartSet; + if (subLine < ll->lines) { + rangeSubLine = ll->SubLineRange(subLine); +@@ -652,26 +652,26 @@ + + SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, bool charPosition, bool virtualSpace, const ViewStyle &vs) { + pt.x = pt.x - vs.textStart; +- int visibleLine = static_cast<int>(floor(pt.y / vs.lineHeight)); ++ Sci::Line visibleLine = static_cast<int>(floor(pt.y / vs.lineHeight)); + if (!canReturnInvalid && (visibleLine < 0)) + visibleLine = 0; +- const int lineDoc = model.cs.DocFromDisplay(visibleLine); ++ const Sci::Line lineDoc = model.cs.DocFromDisplay(visibleLine); + if (canReturnInvalid && (lineDoc < 0)) + return SelectionPosition(INVALID_POSITION); + if (lineDoc >= model.pdoc->LinesTotal()) + return SelectionPosition(canReturnInvalid ? INVALID_POSITION : model.pdoc->Length()); +- const int posLineStart = model.pdoc->LineStart(lineDoc); ++ const Sci::Position posLineStart = model.pdoc->LineStart(lineDoc); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); + if (surface && ll) { + LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); +- const int lineStartSet = model.cs.DisplayFromDoc(lineDoc); ++ const Sci::Line lineStartSet = model.cs.DisplayFromDoc(lineDoc); + const int subLine = visibleLine - lineStartSet; + if (subLine < ll->lines) { + const Range rangeSubLine = ll->SubLineRange(subLine); + const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; + if (subLine > 0) // Wrapped + pt.x -= ll->wrapIndent; +- const int positionInLine = ll->FindPositionFromX(static_cast<XYPOSITION>(pt.x + subLineStart), ++ const Sci::Position positionInLine = ll->FindPositionFromX(static_cast<XYPOSITION>(pt.x + subLineStart), + rangeSubLine, charPosition); + if (positionInLine < rangeSubLine.end) { + return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1)); +@@ -700,14 +700,14 @@ + * Ensure is between whole characters when document is in multi-byte or UTF-8 mode. + * This method is used for rectangular selections and does not work on wrapped lines. + */ +-SelectionPosition EditView::SPositionFromLineX(Surface *surface, const EditModel &model, int lineDoc, int x, const ViewStyle &vs) { ++SelectionPosition EditView::SPositionFromLineX(Surface *surface, const EditModel &model, Sci::Line lineDoc, int x, const ViewStyle &vs) { + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); + if (surface && ll) { +- const int posLineStart = model.pdoc->LineStart(lineDoc); ++ const Sci::Position posLineStart = model.pdoc->LineStart(lineDoc); + LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); + const Range rangeSubLine = ll->SubLineRange(0); + const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; +- const int positionInLine = ll->FindPositionFromX(x + subLineStart, rangeSubLine, false); ++ const Sci::Position positionInLine = ll->FindPositionFromX(x + subLineStart, rangeSubLine, false); + if (positionInLine < rangeSubLine.end) { + return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1)); + } +@@ -719,14 +719,14 @@ + return SelectionPosition(0); + } + +-int EditView::DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs) { +- int lineDoc = model.pdoc->LineFromPosition(pos); +- int lineDisplay = model.cs.DisplayFromDoc(lineDoc); ++Sci::Line EditView::DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs) { ++ Sci::Line lineDoc = model.pdoc->LineFromPosition(pos); ++ Sci::Line lineDisplay = model.cs.DisplayFromDoc(lineDoc); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); + if (surface && ll) { + LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); +- unsigned int posLineStart = model.pdoc->LineStart(lineDoc); +- int posInLine = pos - posLineStart; ++ Sci::Position posLineStart = model.pdoc->LineStart(lineDoc); ++ Sci::Position posInLine = pos - posLineStart; + lineDisplay--; // To make up for first increment ahead. + for (int subLine = 0; subLine < ll->lines; subLine++) { + if (posInLine >= ll->LineStart(subLine)) { +@@ -737,14 +737,14 @@ + return lineDisplay; + } + +-int EditView::StartEndDisplayLine(Surface *surface, const EditModel &model, int pos, bool start, const ViewStyle &vs) { +- int line = model.pdoc->LineFromPosition(pos); ++Sci::Position EditView::StartEndDisplayLine(Surface *surface, const EditModel &model, Sci::Position pos, bool start, const ViewStyle &vs) { ++ Sci::Line line = model.pdoc->LineFromPosition(pos); + AutoLineLayout ll(llc, RetrieveLineLayout(line, model)); +- int posRet = INVALID_POSITION; ++ Sci::Position posRet = INVALID_POSITION; + if (surface && ll) { +- unsigned int posLineStart = model.pdoc->LineStart(line); ++ Sci::Position posLineStart = model.pdoc->LineStart(line); + LayoutLine(model, line, surface, vs, ll, model.wrapWidth); +- int posInLine = pos - posLineStart; ++ Sci::Position posInLine = pos - posLineStart; + if (posInLine <= ll->maxLineLength) { + for (int subLine = 0; subLine < ll->lines; subLine++) { + if ((posInLine >= ll->LineStart(subLine)) && +@@ -772,7 +772,7 @@ + } + + static ColourDesired TextBackground(const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- ColourOptional background, int inSelection, bool inHotspot, int styleMain, int i) { ++ ColourOptional background, int inSelection, bool inHotspot, int styleMain, Sci::Position i) { + if (inSelection == 1) { + if (vsDraw.selColours.back.isSet && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { + return SelectionBackground(vsDraw, true, model.primarySelection); +@@ -796,7 +796,7 @@ + } + } + +-void EditView::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight) { ++void EditView::DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, Sci::Position start, PRectangle rcSegment, bool highlight) { + Point from = Point::FromInts(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); + PRectangle rcCopyArea = PRectangle::FromInts(start + 1, static_cast<int>(rcSegment.top), start + 2, static_cast<int>(rcSegment.bottom)); + surface->Copy(rcCopyArea, from, +@@ -836,10 +836,10 @@ + } + + void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- PRectangle rcLine, int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, ++ PRectangle rcLine, Sci::Line line, Sci::Position lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, + ColourOptional background) { + +- const int posLineStart = model.pdoc->LineStart(line); ++ const Sci::Position posLineStart = model.pdoc->LineStart(line); + PRectangle rcSegment = rcLine; + + const bool lastSubLine = subLine == (ll->lines - 1); +@@ -879,7 +879,7 @@ + int eolInSelection = 0; + int alpha = SC_ALPHA_NOALPHA; + if (!hideSelection) { +- int posAfterLineEnd = model.pdoc->LineStart(line + 1); ++ Sci::Position posAfterLineEnd = model.pdoc->LineStart(line + 1); + eolInSelection = (lastSubLine == true) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0; + alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; + } +@@ -887,7 +887,7 @@ + // Draw the [CR], [LF], or [CR][LF] blobs if visible line ends are on + XYPOSITION blobsWidth = 0; + if (lastSubLine) { +- for (int eolPos = ll->numCharsBeforeEOL; eolPos<ll->numCharsInLine; eolPos++) { ++ for (Sci::Position eolPos = ll->numCharsBeforeEOL; eolPos<ll->numCharsInLine; eolPos++) { + rcSegment.left = xStart + ll->positions[eolPos] - static_cast<XYPOSITION>(subLineStart)+virtualSpace; + rcSegment.right = xStart + ll->positions[eolPos + 1] - static_cast<XYPOSITION>(subLineStart)+virtualSpace; + blobsWidth += rcSegment.Width(); +@@ -987,8 +987,8 @@ + } + } + +-static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw, +- const LineLayout *ll, int xStart, PRectangle rcLine, int secondCharacter, int subLine, Indicator::DrawState drawState, int value) { ++static void DrawIndicator(int indicNum, Sci::Position startPos, Sci::Position endPos, Surface *surface, const ViewStyle &vsDraw, ++ const LineLayout *ll, int xStart, PRectangle rcLine, Sci::Position secondCharacter, int subLine, Indicator::DrawState drawState, int value) { + const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)]; + PRectangle rcIndic( + ll->positions[startPos] + xStart - subLineStart, +@@ -1008,26 +1008,26 @@ + } + + static void DrawIndicators(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, int xStart, PRectangle rcLine, int subLine, int lineEnd, bool under, int hoverIndicatorPos) { ++ Sci::Line line, int xStart, PRectangle rcLine, int subLine, Sci::Position lineEnd, bool under, Sci::Position hoverIndicatorPos) { + // Draw decorators +- const int posLineStart = model.pdoc->LineStart(line); +- const int lineStart = ll->LineStart(subLine); +- const int posLineEnd = posLineStart + lineEnd; ++ const Sci::Position posLineStart = model.pdoc->LineStart(line); ++ const Sci::Position lineStart = ll->LineStart(subLine); ++ const Sci::Position posLineEnd = posLineStart + lineEnd; + + for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) { + if (under == vsDraw.indicators[deco->indicator].under) { +- int startPos = posLineStart + lineStart; ++ Sci::Position startPos = posLineStart + lineStart; + if (!deco->rs.ValueAt(startPos)) { + startPos = deco->rs.EndRun(startPos); + } + while ((startPos < posLineEnd) && (deco->rs.ValueAt(startPos))) { + const Range rangeRun(deco->rs.StartRun(startPos), deco->rs.EndRun(startPos)); +- const int endPos = std::min(rangeRun.end, posLineEnd); ++ const Sci::Position endPos = std::min(rangeRun.end, posLineEnd); + const bool hover = vsDraw.indicators[deco->indicator].IsDynamic() && + rangeRun.ContainsCharacter(hoverIndicatorPos); + const int value = deco->rs.ValueAt(startPos); + Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal; +- const int posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1); ++ const Sci::Position posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1); + DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart, + surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, drawState, value); + startPos = endPos; +@@ -1045,16 +1045,16 @@ + if (under == vsDraw.indicators[braceIndicator].under) { + Range rangeLine(posLineStart + lineStart, posLineEnd); + if (rangeLine.ContainsCharacter(model.braces[0])) { +- int braceOffset = model.braces[0] - posLineStart; ++ Sci::Position braceOffset = model.braces[0] - posLineStart; + if (braceOffset < ll->numCharsInLine) { +- const int secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[0] + 1, 1) - posLineStart; ++ const Sci::Position secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[0] + 1, 1) - posLineStart; + DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset, subLine, Indicator::drawNormal, 1); + } + } + if (rangeLine.ContainsCharacter(model.braces[1])) { +- int braceOffset = model.braces[1] - posLineStart; ++ Sci::Position braceOffset = model.braces[1] - posLineStart; + if (braceOffset < ll->numCharsInLine) { +- const int secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[1] + 1, 1) - posLineStart; ++ const Sci::Position secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[1] + 1, 1) - posLineStart; + DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset, subLine, Indicator::drawNormal, 1); + } + } +@@ -1063,7 +1063,7 @@ + } + + void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase) { ++ Sci::Line line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase) { + const bool lastSubLine = subLine == (ll->lines - 1); + if (!lastSubLine) + return; +@@ -1080,7 +1080,7 @@ + int eolInSelection = 0; + int alpha = SC_ALPHA_NOALPHA; + if (!hideSelection) { +- int posAfterLineEnd = model.pdoc->LineStart(line + 1); ++ Sci::Position posAfterLineEnd = model.pdoc->LineStart(line + 1); + eolInSelection = (subLine == (ll->lines - 1)) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0; + alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; + } +@@ -1159,7 +1159,7 @@ + } + + void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { ++ Sci::Line line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { + int indent = static_cast<int>(model.pdoc->GetLineIndentation(line) * vsDraw.spaceWidth); + PRectangle rcSegment = rcLine; + int annotationLine = subLine - ll->lines; +@@ -1216,18 +1216,18 @@ + } + + static void DrawBlockCaret(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) { ++ int subLine, int xStart, Sci::Position offset, Sci::Position posCaret, PRectangle rcCaret, ColourDesired caretColour) { + +- int lineStart = ll->LineStart(subLine); +- int posBefore = posCaret; +- int posAfter = model.pdoc->MovePositionOutsideChar(posCaret + 1, 1); +- int numCharsToDraw = posAfter - posCaret; ++ Sci::Position lineStart = ll->LineStart(subLine); ++ Sci::Position posBefore = posCaret; ++ Sci::Position posAfter = model.pdoc->MovePositionOutsideChar(posCaret + 1, 1); ++ Sci::Position numCharsToDraw = posAfter - posCaret; + + // Work out where the starting and ending offsets are. We need to + // see if the previous character shares horizontal space, such as a + // glyph / combining character. If so we'll need to draw that too. +- int offsetFirstChar = offset; +- int offsetLastChar = offset + (posAfter - posCaret); ++ Sci::Position offsetFirstChar = offset; ++ Sci::Position offsetLastChar = offset + (posAfter - posCaret); + while ((posBefore > 0) && ((offsetLastChar - numCharsToDraw) >= lineStart)) { + if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - numCharsToDraw]) > 0) { + // The char does not share horizontal space +@@ -1282,12 +1282,12 @@ + } + + void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int lineDoc, int xStart, PRectangle rcLine, int subLine) const { ++ Sci::Line lineDoc, int xStart, PRectangle rcLine, int subLine) const { + // When drag is active it is the only caret drawn + bool drawDrag = model.posDrag.IsValid(); + if (hideSelection && !drawDrag) + return; +- const int posLineStart = model.pdoc->LineStart(lineDoc); ++ const Sci::Position posLineStart = model.pdoc->LineStart(lineDoc); + // For each selection draw + for (size_t r = 0; (r<model.sel.Count()) || drawDrag; r++) { + const bool mainCaret = r == model.sel.Main(); +@@ -1304,7 +1304,7 @@ + if (ll->InLine(offset, subLine) && offset <= ll->numCharsBeforeEOL) { + XYPOSITION xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)]; + if (ll->wrapIndent != 0) { +- int lineStart = ll->LineStart(subLine); ++ Sci::Position lineStart = ll->LineStart(subLine); + if (lineStart != 0) // Wrapped + xposCaret += ll->wrapIndent; + } +@@ -1399,7 +1399,7 @@ + } + + void EditView::DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- PRectangle rcLine, Range lineRange, int posLineStart, int xStart, ++ PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart, + int subLine, ColourOptional background) const { + + const bool selBackDrawn = vsDraw.SelectionBackgroundDrawn(); +@@ -1416,8 +1416,8 @@ + while (bfBack.More()) { + + const TextSegment ts = bfBack.Next(); +- const int i = ts.end() - 1; +- const int iDoc = i + posLineStart; ++ const Sci::Position i = ts.end() - 1; ++ const Sci::Position iDoc = i + posLineStart; + + PRectangle rcSegment = rcLine; + rcSegment.left = ll->positions[ts.start] + xStart - static_cast<XYPOSITION>(subLineStart); +@@ -1498,7 +1498,7 @@ + + // Draw underline mark as part of background if not transparent + static void DrawMarkUnderline(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, +- int line, PRectangle rcLine) { ++ Sci::Line line, PRectangle rcLine) { + int marks = model.pdoc->GetMark(line); + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE) && +@@ -1511,12 +1511,12 @@ + } + } + static void DrawTranslucentSelection(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, PRectangle rcLine, int subLine, Range lineRange, int xStart) { ++ Sci::Line line, PRectangle rcLine, int subLine, Range lineRange, int xStart) { + if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha != SC_ALPHA_NOALPHA)) { +- const int posLineStart = model.pdoc->LineStart(line); ++ const Sci::Position posLineStart = model.pdoc->LineStart(line); + const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; + // For each selection draw +- int virtualSpaces = 0; ++ Sci::Position virtualSpaces = 0; + if (subLine == (ll->lines - 1)) { + virtualSpaces = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)); + } +@@ -1550,7 +1550,7 @@ + + // Draw any translucent whole line states + static void DrawTranslucentLineState(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, PRectangle rcLine) { ++ Sci::Line line, PRectangle rcLine) { + if ((model.caret.active || vsDraw.alwaysShowCaretLineBackground) && vsDraw.showCaretLineBackground && ll->containsCaret) { + SimpleAlphaRectangle(surface, rcLine, vsDraw.caretLineBackground, vsDraw.caretLineAlpha); + } +@@ -1578,7 +1578,7 @@ + } + + void EditView::DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int lineVisible, PRectangle rcLine, Range lineRange, int posLineStart, int xStart, ++ Sci::Line lineVisible, PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart, + int subLine, ColourOptional background) { + + const bool selBackDrawn = vsDraw.SelectionBackgroundDrawn(); +@@ -1598,8 +1598,8 @@ + while (bfFore.More()) { + + const TextSegment ts = bfFore.Next(); +- const int i = ts.end() - 1; +- const int iDoc = i + posLineStart; ++ const Sci::Position i = ts.end() - 1; ++ const Sci::Position iDoc = i + posLineStart; + + PRectangle rcSegment = rcLine; + rcSegment.left = ll->positions[ts.start] + xStart - static_cast<XYPOSITION>(subLineStart); +@@ -1770,16 +1770,16 @@ + } + + void EditView::DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, int lineVisible, PRectangle rcLine, int xStart, int subLine) { ++ Sci::Line line, Sci::Line lineVisible, PRectangle rcLine, int xStart, int subLine) { + if ((vsDraw.viewIndentationGuides == ivLookForward || vsDraw.viewIndentationGuides == ivLookBoth) + && (subLine == 0)) { +- const int posLineStart = model.pdoc->LineStart(line); ++ const Sci::Position posLineStart = model.pdoc->LineStart(line); + int indentSpace = model.pdoc->GetLineIndentation(line); + int xStartText = static_cast<int>(ll->positions[model.pdoc->GetLineIndentPosition(line) - posLineStart]); + + // Find the most recent line with some text + +- int lineLastWithText = line; ++ Sci::Line lineLastWithText = line; + while (lineLastWithText > Platform::Maximum(line - 20, 0) && model.pdoc->IsWhiteLine(lineLastWithText)) { + lineLastWithText--; + } +@@ -1802,7 +1802,7 @@ + } + } + +- int lineNextWithText = line; ++ Sci::Line lineNextWithText = line; + while (lineNextWithText < Platform::Minimum(line + 20, model.pdoc->LinesTotal()) && model.pdoc->IsWhiteLine(lineNextWithText)) { + lineNextWithText++; + } +@@ -1824,7 +1824,7 @@ + } + + void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, int lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { ++ Sci::Line line, Sci::Line lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { + + if (subLine >= ll->lines) { + DrawAnnotation(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, phase); +@@ -1834,7 +1834,7 @@ + // See if something overrides the line background color. + const ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); + +- const int posLineStart = model.pdoc->LineStart(line); ++ const Sci::Position posLineStart = model.pdoc->LineStart(line); + + const Range lineRange = ll->SubLineRange(subLine); + const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; +@@ -1894,7 +1894,7 @@ + } + } + +-static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, int line, PRectangle rcLine) { ++static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, Sci::Line line, PRectangle rcLine) { + bool expanded = model.cs.GetExpanded(line); + const int level = model.pdoc->GetLevel(line); + const int levelNext = model.pdoc->GetLevel(line + 1); +@@ -1944,7 +1944,7 @@ + SelectionPosition posCaret = model.sel.RangeMain().caret; + if (model.posDrag.IsValid()) + posCaret = model.posDrag; +- const int lineCaret = model.pdoc->LineFromPosition(posCaret.Position()); ++ const Sci::Line lineCaret = model.pdoc->LineFromPosition(posCaret.Position()); + + PRectangle rcTextArea = rcClient; + if (vsDraw.marginInside) { +@@ -1971,7 +1971,7 @@ + const bool bracesIgnoreStyle = ((vsDraw.braceHighlightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACELIGHT)) || + (vsDraw.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD))); + +- int lineDocPrevious = -1; // Used to avoid laying out one document line multiple times ++ Sci::Line lineDocPrevious = -1; // Used to avoid laying out one document line multiple times + AutoLineLayout ll(llc, 0); + std::vector<DrawPhase> phases; + if ((phasesDraw == phasesMultiple) && !bufferedDraw) { +@@ -1986,13 +1986,13 @@ + if (!bufferedDraw) + ypos += screenLinePaintFirst * vsDraw.lineHeight; + int yposScreen = screenLinePaintFirst * vsDraw.lineHeight; +- int visibleLine = model.TopLineOfMain() + screenLinePaintFirst; ++ Sci::Line visibleLine = model.TopLineOfMain() + screenLinePaintFirst; + while (visibleLine < model.cs.LinesDisplayed() && yposScreen < rcArea.bottom) { + +- const int lineDoc = model.cs.DocFromDisplay(visibleLine); ++ const Sci::Line lineDoc = model.cs.DocFromDisplay(visibleLine); + // Only visible lines should be handled by the code within the loop + PLATFORM_ASSERT(model.cs.GetVisible(lineDoc)); +- const int lineStartSet = model.cs.DisplayFromDoc(lineDoc); ++ const Sci::Line lineStartSet = model.cs.DisplayFromDoc(lineDoc); + const int subLine = visibleLine - lineStartSet; + + // Copy this line and its styles from the document into local arrays +@@ -2099,11 +2099,11 @@ + } + + void EditView::FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, PRectangle rcArea, int subLine) const { ++ Sci::Line line, PRectangle rcArea, int subLine) const { + int eolInSelection = 0; + int alpha = SC_ALPHA_NOALPHA; + if (!hideSelection) { +- int posAfterLineEnd = model.pdoc->LineStart(line + 1); ++ Sci::Position posAfterLineEnd = model.pdoc->LineStart(line + 1); + eolInSelection = (subLine == (ll->lines - 1)) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0; + alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; + } +@@ -2212,17 +2212,17 @@ + vsPrint.Refresh(*surfaceMeasure, model.pdoc->tabInChars); // Recalculate fixedColumnWidth + } + +- int linePrintStart = model.pdoc->LineFromPosition(static_cast<int>(pfr->chrg.cpMin)); +- int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; ++ Sci::Line linePrintStart = model.pdoc->LineFromPosition(static_cast<int>(pfr->chrg.cpMin)); ++ Sci::Line linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; + if (linePrintLast < linePrintStart) + linePrintLast = linePrintStart; +- int linePrintMax = model.pdoc->LineFromPosition(static_cast<int>(pfr->chrg.cpMax)); ++ Sci::Line linePrintMax = model.pdoc->LineFromPosition(static_cast<int>(pfr->chrg.cpMax)); + if (linePrintLast > linePrintMax) + linePrintLast = linePrintMax; + //Platform::DebugPrintf("Formatting lines=[%0d,%0d,%0d] top=%0d bottom=%0d line=%0d %0d\n", + // linePrintStart, linePrintLast, linePrintMax, pfr->rc.top, pfr->rc.bottom, vsPrint.lineHeight, + // surfaceMeasure->Height(vsPrint.styles[STYLE_LINENUMBER].font)); +- int endPosPrint = model.pdoc->Length(); ++ Sci::Position endPosPrint = model.pdoc->Length(); + if (linePrintLast < model.pdoc->LinesTotal()) + endPosPrint = model.pdoc->LineStart(linePrintLast + 1); + +@@ -2232,9 +2232,9 @@ + int xStart = vsPrint.fixedColumnWidth + pfr->rc.left; + int ypos = pfr->rc.top; + +- int lineDoc = linePrintStart; ++ Sci::Line lineDoc = linePrintStart; + +- int nPrintPos = static_cast<int>(pfr->chrg.cpMin); ++ Sci::Position nPrintPos = static_cast<Sci::Position>(pfr->chrg.cpMin); + int visibleLine = 0; + int widthPrint = pfr->rc.right - pfr->rc.left - vsPrint.fixedColumnWidth; + if (printParameters.wrapState == eWrapNone) +@@ -2265,7 +2265,7 @@ + // to start printing from to ensure a particular position is on the first + // line of the page. + if (visibleLine == 0) { +- int startWithinLine = nPrintPos - model.pdoc->LineStart(lineDoc); ++ Sci::Position startWithinLine = nPrintPos - model.pdoc->LineStart(lineDoc); + for (int iwl = 0; iwl < ll.lines - 1; iwl++) { + if (ll.LineStart(iwl) <= startWithinLine && ll.LineStart(iwl + 1) >= startWithinLine) { + visibleLine = -iwl; +diff -r 1788f6795302 -r a0f26eaf474d src/EditView.h +--- a/src/EditView.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/EditView.h Fri Mar 31 18:19:38 2017 +1100 +@@ -97,53 +97,53 @@ + bool LinesOverlap() const; + + void ClearAllTabstops(); +- XYPOSITION NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const; +- bool ClearTabstops(int line); +- bool AddTabstop(int line, int x); +- int GetNextTabstop(int line, int x) const; +- void LinesAddedOrRemoved(int lineOfPos, int linesAdded); ++ XYPOSITION NextTabstopPos(Sci::Line line, XYPOSITION x, XYPOSITION tabWidth) const; ++ bool ClearTabstops(Sci::Line line); ++ bool AddTabstop(Sci::Line line, int x); ++ int GetNextTabstop(Sci::Line line, int x) const; ++ void LinesAddedOrRemoved(Sci::Line lineOfPos, Sci::Line linesAdded); + + void DropGraphics(bool freeObjects); + void AllocateGraphics(const ViewStyle &vsDraw); + void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw); + +- LineLayout *RetrieveLineLayout(int lineNumber, const EditModel &model); +- void LayoutLine(const EditModel &model, int line, Surface *surface, const ViewStyle &vstyle, ++ LineLayout *RetrieveLineLayout(Sci::Line lineNumber, const EditModel &model); ++ void LayoutLine(const EditModel &model, Sci::Line line, Surface *surface, const ViewStyle &vstyle, + LineLayout *ll, int width = LineLayout::wrapWidthInfinite); + +- Point LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, int topLine, ++ Point LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, Sci::Line topLine, + const ViewStyle &vs, PointEnd pe); +- Range RangeDisplayLine(Surface *surface, const EditModel &model, int lineVisible, const ViewStyle &vs); ++ Range RangeDisplayLine(Surface *surface, const EditModel &model, Sci::Line lineVisible, const ViewStyle &vs); + SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, + bool charPosition, bool virtualSpace, const ViewStyle &vs); +- SelectionPosition SPositionFromLineX(Surface *surface, const EditModel &model, int lineDoc, int x, const ViewStyle &vs); +- int DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs); +- int StartEndDisplayLine(Surface *surface, const EditModel &model, int pos, bool start, const ViewStyle &vs); ++ SelectionPosition SPositionFromLineX(Surface *surface, const EditModel &model, Sci::Line lineDoc, int x, const ViewStyle &vs); ++ Sci::Line DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs); ++ Sci::Position StartEndDisplayLine(Surface *surface, const EditModel &model, Sci::Position pos, bool start, const ViewStyle &vs); + +- void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight); ++ void DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, Sci::Position start, PRectangle rcSegment, bool highlight); + void DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, +- int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, ++ Sci::Line line, Sci::Position lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, + ColourOptional background); + void DrawFoldDisplayText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase); ++ Sci::Line line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase); + void DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase); +- void DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, ++ Sci::Line line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase); ++ void DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line line, + int xStart, PRectangle rcLine, int subLine) const; + void DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, +- Range lineRange, int posLineStart, int xStart, ++ Range lineRange, Sci::Position posLineStart, int xStart, + int subLine, ColourOptional background) const; +- void DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int lineVisible, +- PRectangle rcLine, Range lineRange, int posLineStart, int xStart, ++ void DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line lineVisible, ++ PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart, + int subLine, ColourOptional background); + void DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, int lineVisible, PRectangle rcLine, int xStart, int subLine); +- void DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, +- int lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase); ++ Sci::Line line, Sci::Line lineVisible, PRectangle rcLine, int xStart, int subLine); ++ void DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line line, ++ Sci::Line lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase); + void PaintText(Surface *surfaceWindow, const EditModel &model, PRectangle rcArea, PRectangle rcClient, + const ViewStyle &vsDraw); + void FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- int line, PRectangle rcArea, int subLine) const; ++ Sci::Line line, PRectangle rcArea, int subLine) const; + long FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, + const EditModel &model, const ViewStyle &vs); + }; +diff -r 1788f6795302 -r a0f26eaf474d src/Editor.cxx +--- a/src/Editor.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/Editor.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -123,7 +123,7 @@ + ptMouseLast.y = 0; + inDragDrop = ddNone; + dropWentOutside = false; +- posDrop = SelectionPosition(invalidPosition); ++ posDrop = SelectionPosition(Sci::invalidPosition); + hotSpotClickPos = INVALID_POSITION; + selectionType = selChar; + +@@ -296,7 +296,7 @@ + return ptDocument; + } + +-int Editor::TopLineOfMain() const { ++Sci::Line Editor::TopLineOfMain() const { + if (wMargin.GetID()) + return 0; + else +@@ -319,25 +319,25 @@ + return rc; + } + +-int Editor::LinesOnScreen() const { ++Sci::Line Editor::LinesOnScreen() const { + PRectangle rcClient = GetClientRectangle(); + int htClient = static_cast<int>(rcClient.bottom - rcClient.top); + //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1); + return htClient / vs.lineHeight; + } + +-int Editor::LinesToScroll() const { +- int retVal = LinesOnScreen() - 1; ++Sci::Line Editor::LinesToScroll() const { ++ Sci::Line retVal = LinesOnScreen() - 1; + if (retVal < 1) + return 1; + else + return retVal; + } + +-int Editor::MaxScrollPos() const { ++Sci::Line Editor::MaxScrollPos() const { + //Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n", + //LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1); +- int retVal = cs.LinesDisplayed(); ++ Sci::Line retVal = cs.LinesDisplayed(); + if (endAtLastLine) { + retVal -= LinesOnScreen(); + } else { +@@ -369,11 +369,11 @@ + return view.LocationFromPosition(surface, *this, pos, topLine, vs, pe); + } + +-Point Editor::LocationFromPosition(int pos, PointEnd pe) { ++Point Editor::LocationFromPosition(Sci::Position pos, PointEnd pe) { + return LocationFromPosition(SelectionPosition(pos), pe); + } + +-int Editor::XFromPosition(int pos) { ++int Editor::XFromPosition(Sci::Position pos) { + Point pt = LocationFromPosition(pos); + return static_cast<int>(pt.x) - vs.textStart + xOffset; + } +@@ -403,7 +403,7 @@ + return view.SPositionFromLocation(surface, *this, ptdoc, canReturnInvalid, charPosition, virtualSpace, vs); + } + +-int Editor::PositionFromLocation(Point pt, bool canReturnInvalid, bool charPosition) { ++Sci::Position Editor::PositionFromLocation(Point pt, bool canReturnInvalid, bool charPosition) { + return SPositionFromLocation(pt, canReturnInvalid, charPosition, false).Position(); + } + +@@ -412,7 +412,7 @@ + * Ensure is between whole characters when document is in multi-byte or UTF-8 mode. + * This method is used for rectangular selections and does not work on wrapped lines. + */ +-SelectionPosition Editor::SPositionFromLineX(int lineDoc, int x) { ++SelectionPosition Editor::SPositionFromLineX(Sci::Line lineDoc, int x) { + RefreshStyleData(); + if (lineDoc >= pdoc->LinesTotal()) + return SelectionPosition(pdoc->Length()); +@@ -421,15 +421,15 @@ + return view.SPositionFromLineX(surface, *this, lineDoc, x, vs); + } + +-int Editor::PositionFromLineX(int lineDoc, int x) { ++Sci::Position Editor::PositionFromLineX(Sci::Line lineDoc, int x) { + return SPositionFromLineX(lineDoc, x).Position(); + } + +-int Editor::LineFromLocation(Point pt) const { ++Sci::Line Editor::LineFromLocation(Point pt) const { + return cs.DocFromDisplay(static_cast<int>(pt.y) / vs.lineHeight + topLine); + } + +-void Editor::SetTopLine(int topLineNew) { ++void Editor::SetTopLine(Sci::Line topLineNew) { + if ((topLine != topLineNew) && (topLineNew >= 0)) { + topLine = topLineNew; + ContainerNeedsUpdate(SC_UPDATE_V_SCROLL); +@@ -480,7 +480,7 @@ + //wMain.InvalidateAll(); + } + +-void Editor::RedrawSelMargin(int line, bool allAfter) { ++void Editor::RedrawSelMargin(Sci::Line line, bool allAfter) { + const bool markersInText = vs.maskInLine || vs.maskDrawInText; + if (!wMargin.GetID() || markersInText) { // May affect text area so may need to abandon and retry + if (AbandonPaint()) { +@@ -526,8 +526,8 @@ + } + + PRectangle Editor::RectangleFromRange(Range r, int overlap) { +- const int minLine = cs.DisplayFromDoc(pdoc->LineFromPosition(r.First())); +- const int maxLine = cs.DisplayLastFromDoc(pdoc->LineFromPosition(r.Last())); ++ const Sci::Line minLine = cs.DisplayFromDoc(pdoc->LineFromPosition(r.First())); ++ const Sci::Line maxLine = cs.DisplayLastFromDoc(pdoc->LineFromPosition(r.Last())); + const PRectangle rcClientDrawing = GetClientDrawingRectangle(); + PRectangle rc; + const int leftTextOverlap = ((xOffset == 0) && (vs.leftMarginWidth > 0)) ? 1 : 0; +@@ -542,11 +542,11 @@ + return rc; + } + +-void Editor::InvalidateRange(int start, int end) { ++void Editor::InvalidateRange(Sci::Position start, Sci::Position end) { + RedrawRect(RectangleFromRange(Range(start, end), view.LinesOverlap() ? vs.lineOverlap : 0)); + } + +-int Editor::CurrentPosition() const { ++Sci::Position Editor::CurrentPosition() const { + return sel.MainCaret(); + } + +@@ -569,10 +569,10 @@ + if (sel.selType == Selection::selThin) { + xCaret = xAnchor; + } +- int lineAnchorRect = pdoc->LineFromPosition(sel.Rectangular().anchor.Position()); +- int lineCaret = pdoc->LineFromPosition(sel.Rectangular().caret.Position()); ++ Sci::Line lineAnchorRect = pdoc->LineFromPosition(sel.Rectangular().anchor.Position()); ++ Sci::Line lineCaret = pdoc->LineFromPosition(sel.Rectangular().caret.Position()); + int increment = (lineCaret > lineAnchorRect) ? 1 : -1; +- for (int line=lineAnchorRect; line != lineCaret+increment; line += increment) { ++ for (Sci::Line line=lineAnchorRect; line != lineCaret+increment; line += increment) { + SelectionRange range(SPositionFromLineX(line, xCaret), SPositionFromLineX(line, xAnchor)); + if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) == 0) + range.ClearVirtualSpace(); +@@ -600,9 +600,9 @@ + if (sel.Count() > 1 || !(sel.RangeMain().anchor == newMain.anchor) || sel.IsRectangular()) { + invalidateWholeSelection = true; + } +- int firstAffected = Platform::Minimum(sel.RangeMain().Start().Position(), newMain.Start().Position()); ++ Sci::Position firstAffected = Platform::Minimum(sel.RangeMain().Start().Position(), newMain.Start().Position()); + // +1 for lastAffected ensures caret repainted +- int lastAffected = Platform::Maximum(newMain.caret.Position()+1, newMain.anchor.Position()); ++ Sci::Position lastAffected = Platform::Maximum(newMain.caret.Position()+1, newMain.anchor.Position()); + lastAffected = Platform::Maximum(lastAffected, sel.RangeMain().End().Position()); + if (invalidateWholeSelection) { + for (size_t r=0; r<sel.Count(); r++) { +@@ -623,7 +623,7 @@ + void Editor::SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_) { + currentPos_ = ClampPositionIntoDocument(currentPos_); + anchor_ = ClampPositionIntoDocument(anchor_); +- int currentLine = pdoc->LineFromPosition(currentPos_.Position()); ++ Sci::Line currentLine = pdoc->LineFromPosition(currentPos_.Position()); + /* For Line selection - ensure the anchor and caret are always + at the beginning and end of the region lines. */ + if (sel.selType == Selection::selLines) { +@@ -650,14 +650,14 @@ + QueueIdleWork(WorkNeeded::workUpdateUI); + } + +-void Editor::SetSelection(int currentPos_, int anchor_) { ++void Editor::SetSelection(Sci::Position currentPos_, Sci::Position anchor_) { + SetSelection(SelectionPosition(currentPos_), SelectionPosition(anchor_)); + } + + // Just move the caret on the main selection + void Editor::SetSelection(SelectionPosition currentPos_) { + currentPos_ = ClampPositionIntoDocument(currentPos_); +- int currentLine = pdoc->LineFromPosition(currentPos_.Position()); ++ Sci::Line currentLine = pdoc->LineFromPosition(currentPos_.Position()); + if (sel.Count() > 1 || !(sel.RangeMain().caret == currentPos_)) { + InvalidateSelection(SelectionRange(currentPos_)); + } +@@ -683,7 +683,7 @@ + } + + void Editor::SetEmptySelection(SelectionPosition currentPos_) { +- int currentLine = pdoc->LineFromPosition(currentPos_.Position()); ++ Sci::Line currentLine = pdoc->LineFromPosition(currentPos_.Position()); + SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_)); + if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) { + InvalidateSelection(rangeNew); +@@ -700,15 +700,15 @@ + QueueIdleWork(WorkNeeded::workUpdateUI); + } + +-void Editor::SetEmptySelection(int currentPos_) { ++void Editor::SetEmptySelection(Sci::Position currentPos_) { + SetEmptySelection(SelectionPosition(currentPos_)); + } + + void Editor::MultipleSelectAdd(AddNumber addNumber) { + if (SelectionEmpty() || !multipleSelection) { + // Select word at caret +- const int startWord = pdoc->ExtendWordSelect(sel.MainCaret(), -1, true); +- const int endWord = pdoc->ExtendWordSelect(startWord, 1, true); ++ const Sci::Position startWord = pdoc->ExtendWordSelect(sel.MainCaret(), -1, true); ++ const Sci::Position endWord = pdoc->ExtendWordSelect(startWord, 1, true); + TrimAndSetSelection(endWord, startWord); + + } else { +@@ -736,11 +736,11 @@ + } + + for (std::vector<Range>::const_iterator it = searchRanges.begin(); it != searchRanges.end(); ++it) { +- int searchStart = it->start; +- const int searchEnd = it->end; ++ Sci::Position searchStart = it->start; ++ const Sci::Position searchEnd = it->end; + for (;;) { +- int lengthFound = static_cast<int>(selectedText.length()); +- int pos = static_cast<int>(pdoc->FindText(searchStart, searchEnd, ++ Sci::Position lengthFound = static_cast<Sci::Position>(selectedText.length()); ++ Sci::Position pos = static_cast<Sci::Position>(pdoc->FindText(searchStart, searchEnd, + selectedText.c_str(), searchFlags, &lengthFound)); + if (pos >= 0) { + sel.AddSelection(SelectionRange(pos + lengthFound, pos)); +@@ -757,14 +757,14 @@ + } + } + +-bool Editor::RangeContainsProtected(int start, int end) const { ++bool Editor::RangeContainsProtected(Sci::Position start, Sci::Position end) const { + if (vs.ProtectionActive()) { + if (start > end) { +- int t = start; ++ Sci::Position t = start; + start = end; + end = t; + } +- for (int pos = start; pos < end; pos++) { ++ for (Sci::Position pos = start; pos < end; pos++) { + if (vs.styles[pdoc->StyleIndexAt(pos)].IsProtected()) + return true; + } +@@ -785,12 +785,12 @@ + /** + * Asks document to find a good position and then moves out of any invisible positions. + */ +-int Editor::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) const { ++Sci::Position Editor::MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd) const { + return MovePositionOutsideChar(SelectionPosition(pos), moveDir, checkLineEnd).Position(); + } + +-SelectionPosition Editor::MovePositionOutsideChar(SelectionPosition pos, int moveDir, bool checkLineEnd) const { +- int posMoved = pdoc->MovePositionOutsideChar(pos.Position(), moveDir, checkLineEnd); ++SelectionPosition Editor::MovePositionOutsideChar(SelectionPosition pos, Sci::Position moveDir, bool checkLineEnd) const { ++ Sci::Position posMoved = pdoc->MovePositionOutsideChar(pos.Position(), moveDir, checkLineEnd); + if (posMoved != pos.Position()) + pos.SetPosition(posMoved); + if (vs.ProtectionActive()) { +@@ -812,7 +812,7 @@ + } + + void Editor::MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, bool ensureVisible) { +- const int currentLine = pdoc->LineFromPosition(newPos.Position()); ++ const Sci::Line currentLine = pdoc->LineFromPosition(newPos.Position()); + if (ensureVisible) { + // In case in need of wrapping to ensure DisplayFromDoc works. + if (currentLine >= wrapPending.start) +@@ -844,7 +844,7 @@ + const SelectionPosition spCaret = ((sel.Count() == 1) && sel.Empty()) ? + sel.Last() : SelectionPosition(INVALID_POSITION); + +- int delta = newPos.Position() - sel.MainCaret(); ++ Sci::Position delta = newPos.Position() - sel.MainCaret(); + newPos = ClampPositionIntoDocument(newPos); + newPos = MovePositionOutsideChar(newPos, delta); + if (!multipleSelection && sel.IsRectangular() && (selt == Selection::selStream)) { +@@ -871,18 +871,18 @@ + MovedCaret(newPos, spCaret, ensureVisible); + } + +-void Editor::MovePositionTo(int newPos, Selection::selTypes selt, bool ensureVisible) { ++void Editor::MovePositionTo(Sci::Position newPos, Selection::selTypes selt, bool ensureVisible) { + MovePositionTo(SelectionPosition(newPos), selt, ensureVisible); + } + + SelectionPosition Editor::MovePositionSoVisible(SelectionPosition pos, int moveDir) { + pos = ClampPositionIntoDocument(pos); + pos = MovePositionOutsideChar(pos, moveDir); +- int lineDoc = pdoc->LineFromPosition(pos.Position()); ++ Sci::Line lineDoc = pdoc->LineFromPosition(pos.Position()); + if (cs.GetVisible(lineDoc)) { + return pos; + } else { +- int lineDisplay = cs.DisplayFromDoc(lineDoc); ++ Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); + if (moveDir > 0) { + // lineDisplay is already line before fold as lines in fold use display line of line after fold + lineDisplay = Platform::Clamp(lineDisplay, 0, cs.LinesDisplayed()); +@@ -894,7 +894,7 @@ + } + } + +-SelectionPosition Editor::MovePositionSoVisible(int pos, int moveDir) { ++SelectionPosition Editor::MovePositionSoVisible(Sci::Position pos, int moveDir) { + return MovePositionSoVisible(SelectionPosition(pos), moveDir); + } + +@@ -908,15 +908,15 @@ + */ + void Editor::SetLastXChosen() { + Point pt = PointMainCaret(); +- lastXChosen = static_cast<int>(pt.x) + xOffset; +-} +- +-void Editor::ScrollTo(int line, bool moveThumb) { +- int topLineNew = Platform::Clamp(line, 0, MaxScrollPos()); ++ lastXChosen = static_cast<Sci::Position>(pt.x) + xOffset; ++} ++ ++void Editor::ScrollTo(Sci::Line line, bool moveThumb) { ++ Sci::Line topLineNew = Platform::Clamp(line, 0, MaxScrollPos()); + if (topLineNew != topLine) { + // Try to optimise small scrolls + #ifndef UNDER_CE +- int linesToMove = topLine - topLineNew; ++ Sci::Line linesToMove = topLine - topLineNew; + bool performBlit = (abs(linesToMove) <= 10) && (paintState == notPainting); + willRedrawAll = !performBlit; + #endif +@@ -941,7 +941,7 @@ + } + } + +-void Editor::ScrollText(int /* linesToMove */) { ++void Editor::ScrollText(Sci::Line /* linesToMove */) { + //Platform::DebugPrintf("Editor::ScrollText %d\n", linesToMove); + Redraw(); + } +@@ -959,9 +959,9 @@ + } + + void Editor::VerticalCentreCaret() { +- int lineDoc = pdoc->LineFromPosition(sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret()); +- int lineDisplay = cs.DisplayFromDoc(lineDoc); +- int newTop = lineDisplay - (LinesOnScreen() / 2); ++ Sci::Line lineDoc = pdoc->LineFromPosition(sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret()); ++ Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); ++ Sci::Line newTop = lineDisplay - (LinesOnScreen() / 2); + if (topLine != newTop) { + SetTopLine(newTop > 0 ? newTop : 0); + RedrawRect(GetClientRectangle()); +@@ -977,16 +977,16 @@ + void Editor::MoveSelectedLines(int lineDelta) { + + // if selection doesn't start at the beginning of the line, set the new start +- int selectionStart = SelectionStart().Position(); +- int startLine = pdoc->LineFromPosition(selectionStart); +- int beginningOfStartLine = pdoc->LineStart(startLine); ++ Sci::Position selectionStart = SelectionStart().Position(); ++ Sci::Line startLine = pdoc->LineFromPosition(selectionStart); ++ Sci::Position beginningOfStartLine = pdoc->LineStart(startLine); + selectionStart = beginningOfStartLine; + + // if selection doesn't end at the beginning of a line greater than that of the start, + // then set it at the beginning of the next one +- int selectionEnd = SelectionEnd().Position(); +- int endLine = pdoc->LineFromPosition(selectionEnd); +- int beginningOfEndLine = pdoc->LineStart(endLine); ++ Sci::Position selectionEnd = SelectionEnd().Position(); ++ Sci::Line endLine = pdoc->LineFromPosition(selectionEnd); ++ Sci::Position beginningOfEndLine = pdoc->LineStart(endLine); + bool appendEol = false; + if (selectionEnd > beginningOfEndLine + || selectionStart == selectionEnd) { +@@ -1015,9 +1015,9 @@ + SelectionText selectedText; + CopySelectionRange(&selectedText); + +- int selectionLength = SelectionRange(selectionStart, selectionEnd).Length(); ++ Sci::Position selectionLength = SelectionRange(selectionStart, selectionEnd).Length(); + Point currentLocation = LocationFromPosition(CurrentPosition()); +- int currentLine = LineFromLocation(currentLocation); ++ Sci::Line currentLine = LineFromLocation(currentLocation); + + if (appendEol) + SetSelection(pdoc->MovePositionOutsideChar(selectionStart - 1, -1), selectionEnd); +@@ -1030,7 +1030,7 @@ + + selectionLength = pdoc->InsertString(CurrentPosition(), selectedText.Data(), selectionLength); + if (appendEol) { +- const int lengthInserted = pdoc->InsertString(CurrentPosition() + selectionLength, eol, istrlen(eol)); ++ const Sci::Position lengthInserted = pdoc->InsertString(CurrentPosition() + selectionLength, eol, istrlen(eol)); + selectionLength += lengthInserted; + } + SetSelection(CurrentPosition(), CurrentPosition() + selectionLength); +@@ -1053,7 +1053,7 @@ + false, false, UserVirtualSpace()), + Selection::noSel, ensureVisible); + } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { +- int yOfLastLineFullyDisplayed = static_cast<int>(rcClient.top) + (LinesOnScreen() - 1) * vs.lineHeight; ++ Sci::Position yOfLastLineFullyDisplayed = static_cast<Sci::Position>(rcClient.top) + (LinesOnScreen() - 1) * vs.lineHeight; + MovePositionTo(SPositionFromLocation( + Point::FromInts(lastXChosen - xOffset, static_cast<int>(rcClient.top) + yOfLastLineFullyDisplayed), + false, false, UserVirtualSpace()), +@@ -1061,7 +1061,7 @@ + } + } + +-int Editor::DisplayFromPosition(int pos) { ++Sci::Line Editor::DisplayFromPosition(Sci::Position pos) { + AutoSurface surface(this); + return view.DisplayFromPosition(surface, *this, pos, vs); + } +@@ -1130,9 +1130,9 @@ + + // Vertical positioning + if ((options & xysVertical) && (pt.y < rcClient.top || ptBottomCaret.y >= rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) { +- const int lineCaret = DisplayFromPosition(range.caret.Position()); +- const int linesOnScreen = LinesOnScreen(); +- const int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2; ++ const Sci::Line lineCaret = DisplayFromPosition(range.caret.Position()); ++ const Sci::Line linesOnScreen = LinesOnScreen(); ++ const Sci::Line halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2; + const bool bSlop = (caretYPolicy & CARET_SLOP) != 0; + const bool bStrict = (caretYPolicy & CARET_STRICT) != 0; + const bool bJump = (caretYPolicy & CARET_JUMPS) != 0; +@@ -1141,9 +1141,9 @@ + // It should be possible to scroll the window to show the caret, + // but this fails to remove the caret on GTK+ + if (bSlop) { // A margin is defined +- int yMoveT, yMoveB; ++ Sci::Line yMoveT, yMoveB; + if (bStrict) { +- int yMarginT, yMarginB; ++ Sci::Line yMarginT, yMarginB; + if (!(options & xysUseMargin)) { + // In drag mode, avoid moves + // otherwise, a double click will select several lines. +@@ -1215,7 +1215,7 @@ + } + } + if (!(range.caret == range.anchor)) { +- const int lineAnchor = DisplayFromPosition(range.anchor.Position()); ++ const Sci::Line lineAnchor = DisplayFromPosition(range.anchor.Position()); + if (lineAnchor < lineCaret) { + // Shift up to show anchor or as much of range as possible + newXY.topLine = std::min(newXY.topLine, lineAnchor); +@@ -1339,8 +1339,8 @@ + newXY.xOffset = std::max(newXY.xOffset, minOffset); + } else { + // Shift to right to show anchor or as much of range as possible +- int minOffset = static_cast<int>(ptAnchor.x + xOffset - rcClient.right) + 1; +- int maxOffset = static_cast<int>(pt.x + xOffset - rcClient.left) - 1; ++ int minOffset = static_cast<Sci::Position>(ptAnchor.x + xOffset - rcClient.right) + 1; ++ int maxOffset = static_cast<Sci::Position>(pt.x + xOffset - rcClient.left) - 1; + newXY.xOffset = std::max(newXY.xOffset, minOffset); + newXY.xOffset = std::min(newXY.xOffset, maxOffset); + } +@@ -1366,7 +1366,7 @@ + PRectangle rcText = GetTextRectangle(); + if (horizontalScrollBarVisible && + rcText.Width() + xOffset > scrollWidth) { +- scrollWidth = xOffset + static_cast<int>(rcText.Width()); ++ scrollWidth = xOffset + static_cast<Sci::Position>(rcText.Width()); + SetScrollBars(); + } + } +@@ -1449,7 +1449,7 @@ + return vs.wrapState != eWrapNone; + } + +-void Editor::NeedWrapping(int docLineStart, int docLineEnd) { ++void Editor::NeedWrapping(Sci::Line docLineStart, Sci::Line docLineEnd) { + //Platform::DebugPrintf("\nNeedWrapping: %0d..%0d\n", docLineStart, docLineEnd); + if (wrapPending.AddRange(docLineStart, docLineEnd)) { + view.llc.Invalidate(LineLayout::llPositions); +@@ -1460,7 +1460,7 @@ + } + } + +-bool Editor::WrapOneLine(Surface *surface, int lineToWrap) { ++bool Editor::WrapOneLine(Surface *surface, Sci::Line lineToWrap) { + AutoLineLayout ll(view.llc, view.RetrieveLineLayout(lineToWrap, *this)); + int linesWrapped = 1; + if (ll) { +@@ -1477,12 +1477,12 @@ + // wsIdle: wrap one page + 100 lines + // Return true if wrapping occurred. + bool Editor::WrapLines(enum wrapScope ws) { +- int goodTopLine = topLine; ++ Sci::Line goodTopLine = topLine; + bool wrapOccurred = false; + if (!Wrapping()) { + if (wrapWidth != LineLayout::wrapWidthInfinite) { + wrapWidth = LineLayout::wrapWidthInfinite; +- for (int lineDoc = 0; lineDoc < pdoc->LinesTotal(); lineDoc++) { ++ for (Sci::Line lineDoc = 0; lineDoc < pdoc->LinesTotal(); lineDoc++) { + cs.SetHeight(lineDoc, 1 + + (vs.annotationVisible ? pdoc->AnnotationLines(lineDoc) : 0)); + } +@@ -1497,9 +1497,9 @@ + ws = WrapScope::wsAll; + } + // Decide where to start wrapping +- int lineToWrap = wrapPending.start; +- int lineToWrapEnd = std::min(wrapPending.end, pdoc->LinesTotal()); +- const int lineDocTop = cs.DocFromDisplay(topLine); ++ Sci::Line lineToWrap = wrapPending.start; ++ Sci::Line lineToWrapEnd = std::min(wrapPending.end, pdoc->LinesTotal()); ++ const Sci::Line lineDocTop = cs.DocFromDisplay(topLine); + const int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop); + if (ws == WrapScope::wsVisible) { + lineToWrap = Platform::Clamp(lineDocTop-5, wrapPending.start, pdoc->LinesTotal()); +@@ -1507,7 +1507,7 @@ + // Since wrapping could reduce display lines, treat each + // as taking only one display line. + lineToWrapEnd = lineDocTop; +- int lines = LinesOnScreen() + 1; ++ Sci::Line lines = LinesOnScreen() + 1; + while ((lineToWrapEnd < cs.LinesInDoc()) && (lines>0)) { + if (cs.GetVisible(lineToWrapEnd)) + lines--; +@@ -1521,7 +1521,7 @@ + } else if (ws == WrapScope::wsIdle) { + lineToWrapEnd = lineToWrap + LinesOnScreen() + 100; + } +- const int lineEndNeedWrap = std::min(wrapPending.end, pdoc->LinesTotal()); ++ const Sci::Line lineEndNeedWrap = std::min(wrapPending.end, pdoc->LinesTotal()); + lineToWrapEnd = std::min(lineToWrapEnd, lineEndNeedWrap); + + // Ensure all lines being wrapped are styled. +@@ -1569,13 +1569,13 @@ + if (!RangeContainsProtected(targetStart, targetEnd)) { + UndoGroup ug(pdoc); + bool prevNonWS = true; +- for (int pos = targetStart; pos < targetEnd; pos++) { ++ for (Sci::Position pos = targetStart; pos < targetEnd; pos++) { + if (pdoc->IsPositionInLineEnd(pos)) { + targetEnd -= pdoc->LenChar(pos); + pdoc->DelChar(pos); + if (prevNonWS) { + // Ensure at least one space separating previous lines +- const int lengthInserted = pdoc->InsertString(pos, " ", 1); ++ const Sci::Position lengthInserted = pdoc->InsertString(pos, " ", 1); + targetEnd += lengthInserted; + } + } else { +@@ -1601,19 +1601,19 @@ + PRectangle rcText = GetTextRectangle(); + pixelWidth = static_cast<int>(rcText.Width()); + } +- int lineStart = pdoc->LineFromPosition(targetStart); +- int lineEnd = pdoc->LineFromPosition(targetEnd); ++ Sci::Line lineStart = pdoc->LineFromPosition(targetStart); ++ Sci::Line lineEnd = pdoc->LineFromPosition(targetEnd); + const char *eol = StringFromEOLMode(pdoc->eolMode); + UndoGroup ug(pdoc); +- for (int line = lineStart; line <= lineEnd; line++) { ++ for (Sci::Line line = lineStart; line <= lineEnd; line++) { + AutoSurface surface(this); + AutoLineLayout ll(view.llc, view.RetrieveLineLayout(line, *this)); + if (surface && ll) { +- unsigned int posLineStart = pdoc->LineStart(line); ++ Sci::Position posLineStart = pdoc->LineStart(line); + view.LayoutLine(*this, line, surface, vs, ll, pixelWidth); +- int lengthInsertedTotal = 0; ++ Sci::Position lengthInsertedTotal = 0; + for (int subLine = 1; subLine < ll->lines; subLine++) { +- const int lengthInserted = pdoc->InsertString( ++ const Sci::Position lengthInserted = pdoc->InsertString( + static_cast<int>(posLineStart + lengthInsertedTotal + + ll->LineStart(subLine)), + eol, istrlen(eol)); +@@ -1803,8 +1803,8 @@ + void Editor::SetScrollBars() { + RefreshStyleData(); + +- int nMax = MaxScrollPos(); +- int nPage = LinesOnScreen(); ++ Sci::Line nMax = MaxScrollPos(); ++ Sci::Line nPage = LinesOnScreen(); + bool modified = ModifyScrollBars(nMax + nPage - 1, nPage); + if (modified) { + DwellEnd(true); +@@ -1838,15 +1838,15 @@ + } + } + +-int Editor::RealizeVirtualSpace(int position, unsigned int virtualSpace) { ++Sci::Position Editor::RealizeVirtualSpace(Sci::Position position, Sci::Position virtualSpace) { + if (virtualSpace > 0) { +- const int line = pdoc->LineFromPosition(position); +- const int indent = pdoc->GetLineIndentPosition(line); ++ const Sci::Line line = pdoc->LineFromPosition(position); ++ const Sci::Position indent = pdoc->GetLineIndentPosition(line); + if (indent == position) { + return pdoc->SetLineIndentation(line, pdoc->GetLineIndentation(line) + virtualSpace); + } else { + std::string spaceText(virtualSpace, ' '); +- const int lengthInserted = pdoc->InsertString(position, spaceText.c_str(), virtualSpace); ++ const Sci::Position lengthInserted = pdoc->InsertString(position, spaceText.c_str(), virtualSpace); + position += lengthInserted; + } + } +@@ -1893,7 +1893,7 @@ + SelectionRange *currentSel = *rit; + if (!RangeContainsProtected(currentSel->Start().Position(), + currentSel->End().Position())) { +- int positionInsert = currentSel->Start().Position(); ++ Sci::Position positionInsert = currentSel->Start().Position(); + if (!currentSel->Empty()) { + if (currentSel->Length()) { + pdoc->DeleteChars(positionInsert, currentSel->Length()); +@@ -1911,7 +1911,7 @@ + } + } + positionInsert = RealizeVirtualSpace(positionInsert, currentSel->caret.VirtualSpace()); +- const int lengthInserted = pdoc->InsertString(positionInsert, s, len); ++ const Sci::Position lengthInserted = pdoc->InsertString(positionInsert, s, len); + if (lengthInserted > 0) { + currentSel->caret.SetPosition(positionInsert + lengthInserted); + currentSel->anchor.SetPosition(positionInsert + lengthInserted); +@@ -1974,7 +1974,7 @@ + for (size_t r = 0; r<sel.Count(); r++) { + if (!RangeContainsProtected(sel.Range(r).Start().Position(), + sel.Range(r).End().Position())) { +- int positionInsert = sel.Range(r).Start().Position(); ++ Sci::Position positionInsert = sel.Range(r).Start().Position(); + if (!sel.Range(r).Empty()) { + if (sel.Range(r).Length()) { + pdoc->DeleteChars(positionInsert, sel.Range(r).Length()); +@@ -1994,7 +1994,7 @@ + if (multiPasteMode == SC_MULTIPASTE_ONCE) { + SelectionPosition selStart = sel.Start(); + selStart = RealizeVirtualSpace(selStart); +- const int lengthInserted = pdoc->InsertString(selStart.Position(), text, len); ++ const Sci::Position lengthInserted = pdoc->InsertString(selStart.Position(), text, len); + if (lengthInserted > 0) { + SetEmptySelection(selStart.Position() + lengthInserted); + } +@@ -2003,7 +2003,7 @@ + for (size_t r=0; r<sel.Count(); r++) { + if (!RangeContainsProtected(sel.Range(r).Start().Position(), + sel.Range(r).End().Position())) { +- int positionInsert = sel.Range(r).Start().Position(); ++ Sci::Position positionInsert = sel.Range(r).Start().Position(); + if (!sel.Range(r).Empty()) { + if (sel.Range(r).Length()) { + pdoc->DeleteChars(positionInsert, sel.Range(r).Length()); +@@ -2014,7 +2014,7 @@ + } + } + positionInsert = RealizeVirtualSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); +- const int lengthInserted = pdoc->InsertString(positionInsert, text, len); ++ const Sci::Position lengthInserted = pdoc->InsertString(positionInsert, text, len); + if (lengthInserted > 0) { + sel.Range(r).caret.SetPosition(positionInsert + lengthInserted); + sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted); +@@ -2037,8 +2037,8 @@ + PasteRectangular(sel.Start(), text, len); + } else { + if (shape == pasteLine) { +- int insertPos = pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())); +- int lengthInserted = pdoc->InsertString(insertPos, text, len); ++ Sci::Position insertPos = pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())); ++ Sci::Position lengthInserted = pdoc->InsertString(insertPos, text, len); + // add the newline if necessary + if ((len > 0) && (text[len - 1] != '\n' && text[len - 1] != '\r')) { + const char *endline = StringFromEOLMode(pdoc->eolMode); +@@ -2127,20 +2127,20 @@ + } + } + +-void Editor::PasteRectangular(SelectionPosition pos, const char *ptr, int len) { ++void Editor::PasteRectangular(SelectionPosition pos, const char *ptr, Sci::Position len) { + if (pdoc->IsReadOnly() || SelectionContainsProtected()) { + return; + } + sel.Clear(); + sel.RangeMain() = SelectionRange(pos); +- int line = pdoc->LineFromPosition(sel.MainCaret()); ++ Sci::Line line = pdoc->LineFromPosition(sel.MainCaret()); + UndoGroup ug(pdoc); + sel.RangeMain().caret = RealizeVirtualSpace(sel.RangeMain().caret); + int xInsert = XFromPosition(sel.RangeMain().caret); + bool prevCr = false; + while ((len > 0) && IsEOLChar(ptr[len-1])) + len--; +- for (int i = 0; i < len; i++) { ++ for (Sci::Position i = 0; i < len; i++) { + if (IsEOLChar(ptr[i])) { + if ((ptr[i] == '\r') || (!prevCr)) + line++; +@@ -2155,13 +2155,13 @@ + if ((XFromPosition(sel.MainCaret()) < xInsert) && (i + 1 < len)) { + while (XFromPosition(sel.MainCaret()) < xInsert) { + assert(pdoc); +- const int lengthInserted = pdoc->InsertString(sel.MainCaret(), " ", 1); ++ const Sci::Position lengthInserted = pdoc->InsertString(sel.MainCaret(), " ", 1); + sel.RangeMain().caret.Add(lengthInserted); + } + } + prevCr = ptr[i] == '\r'; + } else { +- const int lengthInserted = pdoc->InsertString(sel.MainCaret(), ptr + i, 1); ++ const Sci::Position lengthInserted = pdoc->InsertString(sel.MainCaret(), ptr + i, 1); + sel.RangeMain().caret.Add(lengthInserted); + prevCr = false; + } +@@ -2215,7 +2215,7 @@ + void Editor::Undo() { + if (pdoc->CanUndo()) { + InvalidateCaret(); +- int newPos = pdoc->Undo(); ++ Sci::Position newPos = pdoc->Undo(); + if (newPos >= 0) + SetEmptySelection(newPos); + EnsureCaretVisible(); +@@ -2224,7 +2224,7 @@ + + void Editor::Redo() { + if (pdoc->CanRedo()) { +- int newPos = pdoc->Redo(); ++ Sci::Position newPos = pdoc->Redo(); + if (newPos >= 0) + SetEmptySelection(newPos); + EnsureCaretVisible(); +@@ -2245,7 +2245,7 @@ + sel.Range(r).caret.SetVirtualSpace(sel.Range(r).caret.VirtualSpace() - 1); + sel.Range(r).anchor.SetVirtualSpace(sel.Range(r).caret.VirtualSpace()); + } else { +- int lineCurrentPos = pdoc->LineFromPosition(sel.Range(r).caret.Position()); ++ Sci::Line lineCurrentPos = pdoc->LineFromPosition(sel.Range(r).caret.Position()); + if (allowLineStartDeletion || (pdoc->LineStart(lineCurrentPos) != sel.Range(r).caret.Position())) { + if (pdoc->GetColumn(sel.Range(r).caret.Position()) <= pdoc->GetLineIndentation(lineCurrentPos) && + pdoc->GetColumn(sel.Range(r).caret.Position()) > 0 && pdoc->backspaceUnindents) { +@@ -2255,7 +2255,7 @@ + int indentationChange = indentation % indentationStep; + if (indentationChange == 0) + indentationChange = indentationStep; +- const int posSelect = pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationChange); ++ const Sci::Position posSelect = pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationChange); + // SetEmptySelection + sel.Range(r) = SelectionRange(posSelect); + } else { +@@ -2296,14 +2296,14 @@ + ctrlID = identifier; + } + +-void Editor::NotifyStyleToNeeded(int endStyleNeeded) { ++void Editor::NotifyStyleToNeeded(Sci::Position endStyleNeeded) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_STYLENEEDED; + scn.position = endStyleNeeded; + NotifyParent(scn); + } + +-void Editor::NotifyStyleNeeded(Document *, void *, int endStyleNeeded) { ++void Editor::NotifyStyleNeeded(Document *, void *, Sci::Position endStyleNeeded) { + NotifyStyleToNeeded(endStyleNeeded); + } + +@@ -2350,7 +2350,7 @@ + NotifyDoubleClick(pt, ModifierFlags(shift, ctrl, alt)); + } + +-void Editor::NotifyHotSpotDoubleClicked(int position, int modifiers) { ++void Editor::NotifyHotSpotDoubleClicked(Sci::Position position, int modifiers) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; + scn.position = position; +@@ -2358,11 +2358,11 @@ + NotifyParent(scn); + } + +-void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt) { ++void Editor::NotifyHotSpotDoubleClicked(Sci::Position position, bool shift, bool ctrl, bool alt) { + NotifyHotSpotDoubleClicked(position, ModifierFlags(shift, ctrl, alt)); + } + +-void Editor::NotifyHotSpotClicked(int position, int modifiers) { ++void Editor::NotifyHotSpotClicked(Sci::Position position, int modifiers) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_HOTSPOTCLICK; + scn.position = position; +@@ -2370,11 +2370,11 @@ + NotifyParent(scn); + } + +-void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) { ++void Editor::NotifyHotSpotClicked(Sci::Position position, bool shift, bool ctrl, bool alt) { + NotifyHotSpotClicked(position, ModifierFlags(shift, ctrl, alt)); + } + +-void Editor::NotifyHotSpotReleaseClick(int position, int modifiers) { ++void Editor::NotifyHotSpotReleaseClick(Sci::Position position, int modifiers) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK; + scn.position = position; +@@ -2382,7 +2382,7 @@ + NotifyParent(scn); + } + +-void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt) { ++void Editor::NotifyHotSpotReleaseClick(Sci::Position position, bool shift, bool ctrl, bool alt) { + NotifyHotSpotReleaseClick(position, ModifierFlags(shift, ctrl, alt)); + } + +@@ -2404,7 +2404,7 @@ + NotifyParent(scn); + } + +-void Editor::NotifyIndicatorClick(bool click, int position, int modifiers) { ++void Editor::NotifyIndicatorClick(bool click, Sci::Position position, int modifiers) { + int mask = pdoc->decorations.AllOnFor(position); + if ((click && mask) || pdoc->decorations.clickNotified) { + SCNotification scn = {}; +@@ -2416,18 +2416,18 @@ + } + } + +-void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt) { ++void Editor::NotifyIndicatorClick(bool click, Sci::Position position, bool shift, bool ctrl, bool alt) { + NotifyIndicatorClick(click, position, ModifierFlags(shift, ctrl, alt)); + } + + bool Editor::NotifyMarginClick(Point pt, int modifiers) { + const int marginClicked = vs.MarginFromLocation(pt); + if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) { +- int position = pdoc->LineStart(LineFromLocation(pt)); ++ Sci::Position position = pdoc->LineStart(LineFromLocation(pt)); + if ((vs.ms[marginClicked].mask & SC_MASK_FOLDERS) && (foldAutomatic & SC_AUTOMATICFOLD_CLICK)) { + const bool ctrl = (modifiers & SCI_CTRL) != 0; + const bool shift = (modifiers & SCI_SHIFT) != 0; +- int lineClick = pdoc->LineFromPosition(position); ++ Sci::Line lineClick = pdoc->LineFromPosition(position); + if (shift && ctrl) { + FoldAll(SC_FOLDACTION_TOGGLE); + } else { +@@ -2465,7 +2465,7 @@ + bool Editor::NotifyMarginRightClick(Point pt, int modifiers) { + int marginRightClicked = vs.MarginFromLocation(pt); + if ((marginRightClicked >= 0) && vs.ms[marginRightClicked].sensitive) { +- int position = pdoc->LineStart(LineFromLocation(pt)); ++ Sci::Position position = pdoc->LineStart(LineFromLocation(pt)); + SCNotification scn = {}; + scn.nmhdr.code = SCN_MARGINRIGHTCLICK; + scn.modifiers = modifiers; +@@ -2478,7 +2478,7 @@ + } + } + +-void Editor::NotifyNeedShown(int pos, int len) { ++void Editor::NotifyNeedShown(Sci::Position pos, Sci::Position len) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_NEEDSHOWN; + scn.position = pos; +@@ -2515,8 +2515,8 @@ + void Editor::CheckModificationForWrap(DocModification mh) { + if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { + view.llc.Invalidate(LineLayout::llCheckTextAndStyle); +- int lineDoc = pdoc->LineFromPosition(mh.position); +- int lines = Platform::Maximum(0, mh.linesAdded); ++ Sci::Line lineDoc = pdoc->LineFromPosition(mh.position); ++ Sci::Line lines = std::max(static_cast<Sci::Line>(0), mh.linesAdded); + if (Wrapping()) { + NeedWrapping(lineDoc, lineDoc + lines + 1); + } +@@ -2527,7 +2527,7 @@ + } + + // Move a position so it is still after the same character as before the insertion. +-static inline int MovePositionForInsertion(int position, int startInsertion, int length) { ++static inline Sci::Position MovePositionForInsertion(Sci::Position position, Sci::Position startInsertion, Sci::Position length) { + if (position > startInsertion) { + return position + length; + } +@@ -2536,9 +2536,9 @@ + + // Move a position so it is still after the same character as before the deletion if that + // character is still present else after the previous surviving character. +-static inline int MovePositionForDeletion(int position, int startDeletion, int length) { ++static inline Sci::Position MovePositionForDeletion(Sci::Position position, Sci::Position startDeletion, Sci::Position length) { + if (position > startDeletion) { +- int endDeletion = startDeletion + length; ++ Sci::Position endDeletion = startDeletion + length; + if (position > endDeletion) { + return position - length; + } else { +@@ -2602,17 +2602,17 @@ + } + if ((mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) && cs.HiddenLines()) { + // Some lines are hidden so may need shown. +- const int lineOfPos = pdoc->LineFromPosition(mh.position); +- int endNeedShown = mh.position; ++ const Sci::Line lineOfPos = pdoc->LineFromPosition(mh.position); ++ Sci::Position endNeedShown = mh.position; + if (mh.modificationType & SC_MOD_BEFOREINSERT) { + if (pdoc->ContainsLineEnd(mh.text, mh.length) && (mh.position != pdoc->LineStart(lineOfPos))) + endNeedShown = pdoc->LineStart(lineOfPos+1); + } else if (mh.modificationType & SC_MOD_BEFOREDELETE) { + // If the deletion includes any EOL then we extend the need shown area. + endNeedShown = mh.position + mh.length; +- int lineLast = pdoc->LineFromPosition(mh.position+mh.length); +- for (int line = lineOfPos + 1; line <= lineLast; line++) { +- const int lineMaxSubord = pdoc->GetLastChild(line, -1, -1); ++ Sci::Line lineLast = pdoc->LineFromPosition(mh.position+mh.length); ++ for (Sci::Line line = lineOfPos + 1; line <= lineLast; line++) { ++ const Sci::Line lineMaxSubord = pdoc->GetLastChild(line, -1, -1); + if (lineLast < lineMaxSubord) { + lineLast = lineMaxSubord; + endNeedShown = pdoc->LineEnd(lineLast); +@@ -2624,7 +2624,7 @@ + if (mh.linesAdded != 0) { + // Update contraction state for inserted and removed lines + // lineOfPos should be calculated in context of state before modification, shouldn't it +- int lineOfPos = pdoc->LineFromPosition(mh.position); ++ Sci::Line lineOfPos = pdoc->LineFromPosition(mh.position); + if (mh.position > pdoc->LineStart(lineOfPos)) + lineOfPos++; // Affecting subsequent lines + if (mh.linesAdded > 0) { +@@ -2635,7 +2635,7 @@ + view.LinesAddedOrRemoved(lineOfPos, mh.linesAdded); + } + if (mh.modificationType & SC_MOD_CHANGEANNOTATION) { +- int lineDoc = pdoc->LineFromPosition(mh.position); ++ Sci::Line lineDoc = pdoc->LineFromPosition(mh.position); + if (vs.annotationVisible) { + cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded); + Redraw(); +@@ -2645,7 +2645,7 @@ + if (mh.linesAdded != 0) { + // Avoid scrolling of display if change before current display + if (mh.position < posTopLine && !CanDeferToLastStep(mh)) { +- int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos()); ++ Sci::Line newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos()); + if (newTop != topLine) { + SetTopLine(newTop); + SetVerticalScrollPos(); +@@ -2857,12 +2857,12 @@ + * If stuttered = true and already at first/last row, scroll as normal. + */ + void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { +- int topLineNew; ++ Sci::Line topLineNew; + SelectionPosition newPos; + +- int currentLine = pdoc->LineFromPosition(sel.MainCaret()); +- int topStutterLine = topLine + caretYSlop; +- int bottomStutterLine = ++ Sci::Line currentLine = pdoc->LineFromPosition(sel.MainCaret()); ++ Sci::Line topStutterLine = topLine + caretYSlop; ++ Sci::Line bottomStutterLine = + pdoc->LineFromPosition(PositionFromLocation( + Point::FromInts(lastXChosen - xOffset, direction * vs.lineHeight * LinesToScroll()))) + - caretYSlop - 1; +@@ -2921,15 +2921,15 @@ + } + size_t endDifferenceText = sText.size() - 1 - lastDifferenceText; + pdoc->DeleteChars( +- static_cast<int>(currentNoVS.Start().Position() + firstDifference), +- static_cast<int>(rangeBytes - firstDifference - endDifferenceText)); +- const int lengthChange = static_cast<int>(lastDifferenceMapped - firstDifference + 1); +- const int lengthInserted = pdoc->InsertString( ++ static_cast<Sci::Position>(currentNoVS.Start().Position() + firstDifference), ++ static_cast<Sci::Position>(rangeBytes - firstDifference - endDifferenceText)); ++ const Sci::Position lengthChange = static_cast<Sci::Position>(lastDifferenceMapped - firstDifference + 1); ++ const Sci::Position lengthInserted = pdoc->InsertString( + static_cast<int>(currentNoVS.Start().Position() + firstDifference), + sMapped.c_str() + firstDifference, + lengthChange); + // Automatic movement changes selection so reset to exactly the same as it was. +- int diffSizes = static_cast<int>(sMapped.size() - sText.size()) + lengthInserted - lengthChange; ++ Sci::Position diffSizes = static_cast<Sci::Position>(sMapped.size() - sText.size()) + lengthInserted - lengthChange; + if (diffSizes != 0) { + if (current.anchor > current.caret) + current.anchor.Add(diffSizes); +@@ -2943,24 +2943,24 @@ + } + + void Editor::LineTranspose() { +- int line = pdoc->LineFromPosition(sel.MainCaret()); ++ Sci::Line line = pdoc->LineFromPosition(sel.MainCaret()); + if (line > 0) { + UndoGroup ug(pdoc); + +- const int startPrevious = pdoc->LineStart(line - 1); ++ const Sci::Position startPrevious = pdoc->LineStart(line - 1); + const std::string linePrevious = RangeText(startPrevious, pdoc->LineEnd(line - 1)); + +- int startCurrent = pdoc->LineStart(line); ++ Sci::Position startCurrent = pdoc->LineStart(line); + const std::string lineCurrent = RangeText(startCurrent, pdoc->LineEnd(line)); + +- pdoc->DeleteChars(startCurrent, static_cast<int>(lineCurrent.length())); +- pdoc->DeleteChars(startPrevious, static_cast<int>(linePrevious.length())); +- startCurrent -= static_cast<int>(linePrevious.length()); ++ pdoc->DeleteChars(startCurrent, static_cast<Sci::Position>(lineCurrent.length())); ++ pdoc->DeleteChars(startPrevious, static_cast<Sci::Position>(linePrevious.length())); ++ startCurrent -= static_cast<Sci::Position>(linePrevious.length()); + + startCurrent += pdoc->InsertString(startPrevious, lineCurrent.c_str(), +- static_cast<int>(lineCurrent.length())); ++ static_cast<Sci::Position>(lineCurrent.length())); + pdoc->InsertString(startCurrent, linePrevious.c_str(), +- static_cast<int>(linePrevious.length())); ++ static_cast<Sci::Position>(linePrevious.length())); + // Move caret to start of current line + MovePositionTo(SelectionPosition(startCurrent)); + } +@@ -2981,20 +2981,20 @@ + SelectionPosition start = sel.Range(r).Start(); + SelectionPosition end = sel.Range(r).End(); + if (forLine) { +- int line = pdoc->LineFromPosition(sel.Range(r).caret.Position()); ++ Sci::Line line = pdoc->LineFromPosition(sel.Range(r).caret.Position()); + start = SelectionPosition(pdoc->LineStart(line)); + end = SelectionPosition(pdoc->LineEnd(line)); + } + std::string text = RangeText(start.Position(), end.Position()); +- int lengthInserted = eolLen; ++ Sci::Position lengthInserted = eolLen; + if (forLine) + lengthInserted = pdoc->InsertString(end.Position(), eol, eolLen); +- pdoc->InsertString(end.Position() + lengthInserted, text.c_str(), static_cast<int>(text.length())); ++ pdoc->InsertString(end.Position() + lengthInserted, text.c_str(), static_cast<Sci::Position>(text.length())); + } + if (sel.Count() && sel.IsRectangular()) { + SelectionPosition last = sel.Last(); + if (forLine) { +- int line = pdoc->LineFromPosition(last.Position()); ++ Sci::Line line = pdoc->LineFromPosition(last.Position()); + last = SelectionPosition(last.Position() + pdoc->LineStart(line+1) - pdoc->LineStart(line)); + } + if (sel.Rectangular().anchor > sel.Rectangular().caret) +@@ -3028,8 +3028,8 @@ + for (size_t r = 0; r < sel.Count(); r++) { + sel.Range(r).ClearVirtualSpace(); + const char *eol = StringFromEOLMode(pdoc->eolMode); +- const int positionInsert = sel.Range(r).caret.Position(); +- const int insertLength = pdoc->InsertString(positionInsert, eol, istrlen(eol)); ++ const Sci::Position positionInsert = sel.Range(r).caret.Position(); ++ const Sci::Position insertLength = pdoc->InsertString(positionInsert, eol, istrlen(eol)); + if (insertLength > 0) { + sel.Range(r) = SelectionRange(positionInsert + insertLength); + countInsertions++; +@@ -3064,12 +3064,12 @@ + int skipLines = 0; + + if (vs.annotationVisible) { +- const int lineDoc = pdoc->LineFromPosition(spStart.Position()); ++ const Sci::Line lineDoc = pdoc->LineFromPosition(spStart.Position()); + const Point ptStartLine = LocationFromPosition(pdoc->LineStart(lineDoc)); + const int subLine = static_cast<int>(pt.y - ptStartLine.y) / vs.lineHeight; + + if (direction < 0 && subLine == 0) { +- const int lineDisplay = cs.DisplayFromDoc(lineDoc); ++ const Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); + if (lineDisplay > 0) { + skipLines = pdoc->AnnotationLines(cs.DocFromDisplay(lineDisplay - 1)); + } +@@ -3078,9 +3078,9 @@ + } + } + +- const int newY = static_cast<int>(pt.y) + (1 + skipLines) * direction * vs.lineHeight; ++ const Sci::Line newY = static_cast<Sci::Line>(pt.y) + (1 + skipLines) * direction * vs.lineHeight; + if (lastX < 0) { +- lastX = static_cast<int>(pt.x) + xOffset; ++ lastX = static_cast<Sci::Position>(pt.x) + xOffset; + } + SelectionPosition posNew = SPositionFromLocation( + Point::FromInts(lastX - xOffset, newY), false, false, UserVirtualSpace()); +@@ -3151,7 +3151,8 @@ + } + + void Editor::ParaUpOrDown(int direction, Selection::selTypes selt) { +- int lineDoc, savedPos = sel.MainCaret(); ++ Sci::Line lineDoc; ++ Sci::Position savedPos = sel.MainCaret(); + do { + MovePositionTo(SelectionPosition(direction > 0 ? pdoc->ParaDown(sel.MainCaret()) : pdoc->ParaUp(sel.MainCaret())), selt); + lineDoc = pdoc->LineFromPosition(sel.MainCaret()); +@@ -3166,16 +3167,16 @@ + } while (!cs.GetVisible(lineDoc)); + } + +-Range Editor::RangeDisplayLine(int lineVisible) { ++Range Editor::RangeDisplayLine(Sci::Line lineVisible) { + RefreshStyleData(); + AutoSurface surface(this); + return view.RangeDisplayLine(surface, *this, lineVisible, vs); + } + +-int Editor::StartEndDisplayLine(int pos, bool start) { ++Sci::Position Editor::StartEndDisplayLine(Sci::Position pos, bool start) { + RefreshStyleData(); + AutoSurface surface(this); +- int posRet = view.StartEndDisplayLine(surface, *this, pos, start, vs); ++ Sci::Position posRet = view.StartEndDisplayLine(surface, *this, pos, start, vs); + if (posRet == INVALID_POSITION) { + return pos; + } else { +@@ -3258,27 +3259,27 @@ + + } + +-int Editor::VCHomeDisplayPosition(int position) { +- const int homePos = pdoc->VCHomePosition(position); +- const int viewLineStart = StartEndDisplayLine(position, true); ++Sci::Position Editor::VCHomeDisplayPosition(Sci::Position position) { ++ const Sci::Position homePos = pdoc->VCHomePosition(position); ++ const Sci::Position viewLineStart = StartEndDisplayLine(position, true); + if (viewLineStart > homePos) + return viewLineStart; + else + return homePos; + } + +-int Editor::VCHomeWrapPosition(int position) { +- const int homePos = pdoc->VCHomePosition(position); +- const int viewLineStart = StartEndDisplayLine(position, true); ++Sci::Position Editor::VCHomeWrapPosition(Sci::Position position) { ++ const Sci::Position homePos = pdoc->VCHomePosition(position); ++ const Sci::Position viewLineStart = StartEndDisplayLine(position, true); + if ((viewLineStart < position) && (viewLineStart > homePos)) + return viewLineStart; + else + return homePos; + } + +-int Editor::LineEndWrapPosition(int position) { +- const int endPos = StartEndDisplayLine(position, false); +- const int realEndPos = pdoc->LineEndPosition(position); ++Sci::Position Editor::LineEndWrapPosition(Sci::Position position) { ++ const Sci::Position endPos = StartEndDisplayLine(position, false); ++ const Sci::Position realEndPos = pdoc->LineEndPosition(position); + if (endPos > realEndPos // if moved past visible EOLs + || position >= endPos) // if at end of display line already + return realEndPos; +@@ -3781,26 +3782,26 @@ + return DelWordOrLine(iMessage); + + case SCI_LINECOPY: { +- int lineStart = pdoc->LineFromPosition(SelectionStart().Position()); +- int lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); ++ Sci::Line lineStart = pdoc->LineFromPosition(SelectionStart().Position()); ++ Sci::Line lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); + CopyRangeToClipboard(pdoc->LineStart(lineStart), + pdoc->LineStart(lineEnd + 1)); + } + break; + case SCI_LINECUT: { +- int lineStart = pdoc->LineFromPosition(SelectionStart().Position()); +- int lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); +- int start = pdoc->LineStart(lineStart); +- int end = pdoc->LineStart(lineEnd + 1); ++ Sci::Line lineStart = pdoc->LineFromPosition(SelectionStart().Position()); ++ Sci::Line lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); ++ Sci::Position start = pdoc->LineStart(lineStart); ++ Sci::Position end = pdoc->LineStart(lineEnd + 1); + SetSelection(start, end); + Cut(); + SetLastXChosen(); + } + break; + case SCI_LINEDELETE: { +- int line = pdoc->LineFromPosition(sel.MainCaret()); +- int start = pdoc->LineStart(line); +- int end = pdoc->LineStart(line + 1); ++ Sci::Line line = pdoc->LineFromPosition(sel.MainCaret()); ++ Sci::Position start = pdoc->LineStart(line); ++ Sci::Position end = pdoc->LineStart(line + 1); + pdoc->DeleteChars(start, end - start); + } + break; +@@ -3854,9 +3855,9 @@ + void Editor::Indent(bool forwards) { + UndoGroup ug(pdoc); + for (size_t r=0; r<sel.Count(); r++) { +- int lineOfAnchor = pdoc->LineFromPosition(sel.Range(r).anchor.Position()); +- int caretPosition = sel.Range(r).caret.Position(); +- int lineCurrentPos = pdoc->LineFromPosition(caretPosition); ++ Sci::Line lineOfAnchor = pdoc->LineFromPosition(sel.Range(r).anchor.Position()); ++ Sci::Position caretPosition = sel.Range(r).caret.Position(); ++ Sci::Line lineCurrentPos = pdoc->LineFromPosition(caretPosition); + if (lineOfAnchor == lineCurrentPos) { + if (forwards) { + pdoc->DeleteChars(sel.Range(r).Start().Position(), sel.Range(r).Length()); +@@ -3865,12 +3866,12 @@ + pdoc->tabIndents) { + int indentation = pdoc->GetLineIndentation(lineCurrentPos); + int indentationStep = pdoc->IndentSize(); +- const int posSelect = pdoc->SetLineIndentation( ++ const Sci::Position posSelect = pdoc->SetLineIndentation( + lineCurrentPos, indentation + indentationStep - indentation % indentationStep); + sel.Range(r) = SelectionRange(posSelect); + } else { + if (pdoc->useTabs) { +- const int lengthInserted = pdoc->InsertString(caretPosition, "\t", 1); ++ const Sci::Position lengthInserted = pdoc->InsertString(caretPosition, "\t", 1); + sel.Range(r) = SelectionRange(caretPosition + lengthInserted); + } else { + int numSpaces = (pdoc->tabInChars) - +@@ -3878,8 +3879,8 @@ + if (numSpaces < 1) + numSpaces = pdoc->tabInChars; + const std::string spaceText(numSpaces, ' '); +- const int lengthInserted = pdoc->InsertString(caretPosition, spaceText.c_str(), +- static_cast<int>(spaceText.length())); ++ const Sci::Position lengthInserted = pdoc->InsertString(caretPosition, spaceText.c_str(), ++ static_cast<Sci::Position>(spaceText.length())); + sel.Range(r) = SelectionRange(caretPosition + lengthInserted); + } + } +@@ -3888,25 +3889,25 @@ + pdoc->tabIndents) { + int indentation = pdoc->GetLineIndentation(lineCurrentPos); + int indentationStep = pdoc->IndentSize(); +- const int posSelect = pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); ++ const Sci::Position posSelect = pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); + sel.Range(r) = SelectionRange(posSelect); + } else { +- int newColumn = ((pdoc->GetColumn(caretPosition) - 1) / pdoc->tabInChars) * ++ Sci::Position newColumn = ((pdoc->GetColumn(caretPosition) - 1) / pdoc->tabInChars) * + pdoc->tabInChars; + if (newColumn < 0) + newColumn = 0; +- int newPos = caretPosition; ++ Sci::Position newPos = caretPosition; + while (pdoc->GetColumn(newPos) > newColumn) + newPos--; + sel.Range(r) = SelectionRange(newPos); + } + } + } else { // Multiline +- int anchorPosOnLine = sel.Range(r).anchor.Position() - pdoc->LineStart(lineOfAnchor); +- int currentPosPosOnLine = caretPosition - pdoc->LineStart(lineCurrentPos); ++ Sci::Position anchorPosOnLine = sel.Range(r).anchor.Position() - pdoc->LineStart(lineOfAnchor); ++ Sci::Position currentPosPosOnLine = caretPosition - pdoc->LineStart(lineCurrentPos); + // Multiple lines selected so indent / dedent +- int lineTopSel = Platform::Minimum(lineOfAnchor, lineCurrentPos); +- int lineBottomSel = Platform::Maximum(lineOfAnchor, lineCurrentPos); ++ Sci::Line lineTopSel = Platform::Minimum(lineOfAnchor, lineCurrentPos); ++ Sci::Line lineBottomSel = Platform::Maximum(lineOfAnchor, lineCurrentPos); + if (pdoc->LineStart(lineBottomSel) == sel.Range(r).anchor.Position() || pdoc->LineStart(lineBottomSel) == caretPosition) + lineBottomSel--; // If not selecting any characters on a line, do not indent + pdoc->Indent(forwards, lineBottomSel, lineTopSel); +@@ -3951,13 +3952,13 @@ + sptr_t lParam) { ///< @c Sci_TextToFind structure: The text to search for in the given range. + + Sci_TextToFind *ft = reinterpret_cast<Sci_TextToFind *>(lParam); +- int lengthFound = istrlen(ft->lpstrText); ++ Sci::Position lengthFound = istrlen(ft->lpstrText); + if (!pdoc->HasCaseFolder()) + pdoc->SetCaseFolder(CaseFolderForEncoding()); + try { + long pos = pdoc->FindText( +- static_cast<int>(ft->chrg.cpMin), +- static_cast<int>(ft->chrg.cpMax), ++ static_cast<Sci::Position>(ft->chrg.cpMin), ++ static_cast<Sci::Position>(ft->chrg.cpMax), + ft->lpstrText, + static_cast<int>(wParam), + &lengthFound); +@@ -4000,7 +4001,7 @@ + + const char *txt = reinterpret_cast<char *>(lParam); + long pos; +- int lengthFound = istrlen(txt); ++ Sci::Position lengthFound = istrlen(txt); + if (!pdoc->HasCaseFolder()) + pdoc->SetCaseFolder(CaseFolderForEncoding()); + try { +@@ -4045,8 +4046,8 @@ + * Search for text in the target range of the document. + * @return The position of the found text, -1 if not found. + */ +-long Editor::SearchInTarget(const char *text, int length) { +- int lengthFound = length; ++long Editor::SearchInTarget(const char *text, Sci::Position length) { ++ Sci::Position lengthFound = length; + + if (!pdoc->HasCaseFolder()) + pdoc->SetCaseFolder(CaseFolderForEncoding()); +@@ -4065,7 +4066,7 @@ + } + } + +-void Editor::GoToLine(int lineNo) { ++void Editor::GoToLine(Sci::Line lineNo) { + if (lineNo > pdoc->LinesTotal()) + lineNo = pdoc->LinesTotal(); + if (lineNo < 0) +@@ -4083,9 +4084,9 @@ + return true; + } + +-std::string Editor::RangeText(int start, int end) const { ++std::string Editor::RangeText(Sci::Position start, Sci::Position end) const { + if (start < end) { +- int len = end - start; ++ Sci::Position len = end - start; + std::string ret(len, '\0'); + for (int i = 0; i < len; i++) { + ret[i] = pdoc->CharAt(start + i); +@@ -4098,9 +4099,9 @@ + void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { + if (sel.Empty()) { + if (allowLineCopy) { +- int currentLine = pdoc->LineFromPosition(sel.MainCaret()); +- int start = pdoc->LineStart(currentLine); +- int end = pdoc->LineEnd(currentLine); ++ Sci::Line currentLine = pdoc->LineFromPosition(sel.MainCaret()); ++ Sci::Position start = pdoc->LineStart(currentLine); ++ Sci::Position end = pdoc->LineEnd(currentLine); + + std::string text = RangeText(start, end); + if (pdoc->eolMode != SC_EOL_LF) +@@ -4130,7 +4131,7 @@ + } + } + +-void Editor::CopyRangeToClipboard(int start, int end) { ++void Editor::CopyRangeToClipboard(Sci::Position start, Sci::Position end) { + start = pdoc->ClampPositionIntoDocument(start); + end = pdoc->ClampPositionIntoDocument(end); + SelectionText selectedText; +@@ -4230,13 +4231,13 @@ + std::string convertedText = Document::TransformLineEnds(value, lengthValue, pdoc->eolMode); + + if (rectangular) { +- PasteRectangular(position, convertedText.c_str(), static_cast<int>(convertedText.length())); ++ PasteRectangular(position, convertedText.c_str(), static_cast<Sci::Position>(convertedText.length())); + // Should try to select new rectangle but it may not be a rectangle now so just select the drop position + SetEmptySelection(position); + } else { + position = MovePositionOutsideChar(position, sel.MainCaret() - position.Position()); + position = RealizeVirtualSpace(position); +- const int lengthInserted = pdoc->InsertString( ++ const Sci::Position lengthInserted = pdoc->InsertString( + position.Position(), convertedText.c_str(), static_cast<int>(convertedText.length())); + if (lengthInserted > 0) { + SelectionPosition posAfterInsertion = position; +@@ -4256,7 +4257,7 @@ + /** + * @return true if given position is inside the selection, + */ +-bool Editor::PositionInSelection(int pos) { ++bool Editor::PositionInSelection(Sci::Position pos) { + pos = MovePositionOutsideChar(pos, sel.MainCaret() - pos); + for (size_t r=0; r<sel.Count(); r++) { + if (sel.Range(r).Contains(pos)) +@@ -4313,16 +4314,16 @@ + return Window::cursorReverseArrow; + } + +-void Editor::TrimAndSetSelection(int currentPos_, int anchor_) { ++void Editor::TrimAndSetSelection(Sci::Position currentPos_, Sci::Position anchor_) { + sel.TrimSelection(SelectionRange(currentPos_, anchor_)); + SetSelection(currentPos_, anchor_); + } + +-void Editor::LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine) { +- int selCurrentPos, selAnchorPos; ++void Editor::LineSelection(Sci::Position lineCurrentPos_, Sci::Position lineAnchorPos_, bool wholeLine) { ++ Sci::Position selCurrentPos, selAnchorPos; + if (wholeLine) { +- int lineCurrent_ = pdoc->LineFromPosition(lineCurrentPos_); +- int lineAnchor_ = pdoc->LineFromPosition(lineAnchorPos_); ++ Sci::Line lineCurrent_ = pdoc->LineFromPosition(lineCurrentPos_); ++ Sci::Line lineAnchor_ = pdoc->LineFromPosition(lineAnchorPos_); + if (lineAnchorPos_ < lineCurrentPos_) { + selCurrentPos = pdoc->LineStart(lineCurrent_ + 1); + selAnchorPos = pdoc->LineStart(lineAnchor_); +@@ -4351,7 +4352,7 @@ + TrimAndSetSelection(selCurrentPos, selAnchorPos); + } + +-void Editor::WordSelection(int pos) { ++void Editor::WordSelection(Sci::Position pos) { + if (pos < wordSelectAnchorStartPos) { + // Extend backward to the word containing pos. + // Skip ExtendWordSelect if the line is empty or if pos is after the last character. +@@ -4472,13 +4473,13 @@ + } + + if (selectionType == selWord) { +- int charPos = originalAnchorPos; ++ Sci::Position charPos = originalAnchorPos; + if (sel.MainCaret() == originalAnchorPos) { + charPos = PositionFromLocation(pt, false, true); + charPos = MovePositionOutsideChar(charPos, -1); + } + +- int startWord, endWord; ++ Sci::Position startWord, endWord; + if ((sel.MainCaret() >= originalAnchorPos) && !pdoc->IsLineEndPosition(charPos)) { + startWord = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(charPos + 1, 1), -1); + endWord = pdoc->ExtendWordSelect(charPos, 1); +@@ -4539,7 +4540,7 @@ + LineSelection(newPos.Position(), lineAnchorPos, selectionType == selWholeLine); + } + +- SetDragPosition(SelectionPosition(invalidPosition)); ++ SetDragPosition(SelectionPosition(Sci::invalidPosition)); + SetMouseCapture(true); + if (FineTickerAvailable()) { + FineTickerStart(tickScroll, 100, 10); +@@ -4560,7 +4561,7 @@ + FineTickerStart(tickScroll, 100, 10); + } + if (inDragDrop != ddInitial) { +- SetDragPosition(SelectionPosition(invalidPosition)); ++ SetDragPosition(SelectionPosition(Sci::invalidPosition)); + if (!shift) { + if (ctrl && multipleSelection) { + SelectionRange range(newPos); +@@ -4603,19 +4604,19 @@ + return ButtonDownWithModifiers(pt, curTime, ModifierFlags(shift, ctrl, alt)); + } + +-bool Editor::PositionIsHotspot(int position) const { ++bool Editor::PositionIsHotspot(Sci::Position position) const { + return vs.styles[pdoc->StyleIndexAt(position)].hotspot; + } + + bool Editor::PointIsHotspot(Point pt) { +- int pos = PositionFromLocation(pt, true, true); ++ Sci::Position pos = PositionFromLocation(pt, true, true); + if (pos == INVALID_POSITION) + return false; + return PositionIsHotspot(pos); + } + +-void Editor::SetHoverIndicatorPosition(int position) { +- int hoverIndicatorPosPrev = hoverIndicatorPos; ++void Editor::SetHoverIndicatorPosition(Sci::Position position) { ++ Sci::Position hoverIndicatorPosPrev = hoverIndicatorPos; + hoverIndicatorPos = INVALID_POSITION; + if (vs.indicatorsDynamic == 0) + return; +@@ -4643,7 +4644,7 @@ + + void Editor::SetHotSpotRange(Point *pt) { + if (pt) { +- int pos = PositionFromLocation(*pt, false, true); ++ Sci::Position pos = PositionFromLocation(*pt, false, true); + + // If we don't limit this to word characters then the + // range can encompass more than the run range and then +@@ -4664,7 +4665,7 @@ + if (hotspot.Valid()) { + InvalidateRange(hotspot.start, hotspot.end); + } +- hotspot = Range(invalidPosition); ++ hotspot = Range(Sci::invalidPosition); + } + } + +@@ -4752,7 +4753,7 @@ + } + + // Autoscroll +- int lineMove = DisplayFromPosition(movePos.Position()); ++ Sci::Line lineMove = DisplayFromPosition(movePos.Position()); + if (pt.y > rcClient.bottom) { + ScrollTo(lineMove - LinesOnScreen() + 1); + Redraw(); +@@ -4789,7 +4790,7 @@ + DisplayCursor(Window::cursorHand); + SetHotSpotRange(&pt); + } else { +- if (hoverIndicatorPos != invalidPosition) ++ if (hoverIndicatorPos != Sci::invalidPosition) + DisplayCursor(Window::cursorHand); + else + DisplayCursor(Window::cursorText); +@@ -4842,14 +4843,14 @@ + if (drag.Length()) { + const int length = static_cast<int>(drag.Length()); + if (ctrl) { +- const int lengthInserted = pdoc->InsertString( ++ const Sci::Position lengthInserted = pdoc->InsertString( + newPos.Position(), drag.Data(), length); + if (lengthInserted > 0) { + SetSelection(newPos.Position(), newPos.Position() + lengthInserted); + } + } else if (newPos < selStart) { + pdoc->DeleteChars(selStart.Position(), static_cast<int>(drag.Length())); +- const int lengthInserted = pdoc->InsertString( ++ const Sci::Position lengthInserted = pdoc->InsertString( + newPos.Position(), drag.Data(), length); + if (lengthInserted > 0) { + SetSelection(newPos.Position(), newPos.Position() + lengthInserted); +@@ -4857,7 +4858,7 @@ + } else if (newPos > selEnd) { + pdoc->DeleteChars(selStart.Position(), static_cast<int>(drag.Length())); + newPos.Add(-static_cast<int>(drag.Length())); +- const int lengthInserted = pdoc->InsertString( ++ const Sci::Position lengthInserted = pdoc->InsertString( + newPos.Position(), drag.Data(), length); + if (lengthInserted > 0) { + SetSelection(newPos.Position(), newPos.Position() + lengthInserted); +@@ -5017,11 +5018,11 @@ + ShowCaretAtCurrentPosition(); + } + +-int Editor::PositionAfterArea(PRectangle rcArea) const { ++Sci::Position Editor::PositionAfterArea(PRectangle rcArea) const { + // The start of the document line after the display line after the area + // This often means that the line after a modification is restyled which helps + // detect multiline comment additions and heals single line comments +- int lineAfter = TopLineOfMain() + static_cast<int>(rcArea.bottom - 1) / vs.lineHeight + 1; ++ Sci::Line lineAfter = TopLineOfMain() + static_cast<Sci::Line>(rcArea.bottom - 1) / vs.lineHeight + 1; + if (lineAfter < cs.LinesDisplayed()) + return pdoc->LineStart(cs.DocFromDisplay(lineAfter) + 1); + else +@@ -5030,8 +5031,8 @@ + + // Style to a position within the view. If this causes a change at end of last line then + // affects later lines so style all the viewed text. +-void Editor::StyleToPositionInView(Position pos) { +- int endWindow = PositionAfterArea(GetClientDrawingRectangle()); ++void Editor::StyleToPositionInView(Sci::Position pos) { ++ Sci::Position endWindow = PositionAfterArea(GetClientDrawingRectangle()); + if (pos > endWindow) + pos = endWindow; + const int styleAtEnd = pdoc->StyleIndexAt(pos-1); +@@ -5046,7 +5047,7 @@ + } + } + +-int Editor::PositionAfterMaxStyling(int posMax, bool scrolling) const { ++Sci::Position Editor::PositionAfterMaxStyling(Sci::Position posMax, bool scrolling) const { + if ((idleStyling == SC_IDLESTYLING_NONE) || (idleStyling == SC_IDLESTYLING_AFTERVISIBLE)) { + // Both states do not limit styling + return posMax; +@@ -5056,12 +5057,12 @@ + // When scrolling, allow less time to ensure responsive + const double secondsAllowed = scrolling ? 0.005 : 0.02; + +- const int linesToStyle = Platform::Clamp(static_cast<int>(secondsAllowed / pdoc->durationStyleOneLine), ++ const Sci::Line linesToStyle = Platform::Clamp(static_cast<int>(secondsAllowed / pdoc->durationStyleOneLine), + 10, 0x10000); +- const int stylingMaxLine = std::min( +- static_cast<int>(pdoc->LineFromPosition(pdoc->GetEndStyled()) + linesToStyle), ++ const Sci::Line stylingMaxLine = std::min( ++ static_cast<Sci::Line>(pdoc->LineFromPosition(pdoc->GetEndStyled()) + linesToStyle), + pdoc->LinesTotal()); +- return std::min(static_cast<int>(pdoc->LineStart(stylingMaxLine)), posMax); ++ return std::min(static_cast<Sci::Position>(pdoc->LineStart(stylingMaxLine)), posMax); + } + + void Editor::StartIdleStyling(bool truncatedLastStyling) { +@@ -5081,8 +5082,8 @@ + + // Style for an area but bound the amount of styling to remain responsive + void Editor::StyleAreaBounded(PRectangle rcArea, bool scrolling) { +- const int posAfterArea = PositionAfterArea(rcArea); +- const int posAfterMax = PositionAfterMaxStyling(posAfterArea, scrolling); ++ const Sci::Position posAfterArea = PositionAfterArea(rcArea); ++ const Sci::Position posAfterMax = PositionAfterMaxStyling(posAfterArea, scrolling); + if (posAfterMax < posAfterArea) { + // Idle styling may be performed before current visible area + // Style a bit now then style further in idle time +@@ -5095,10 +5096,10 @@ + } + + void Editor::IdleStyling() { +- const int posAfterArea = PositionAfterArea(GetClientRectangle()); +- const int endGoal = (idleStyling >= SC_IDLESTYLING_AFTERVISIBLE) ? ++ const Sci::Position posAfterArea = PositionAfterArea(GetClientRectangle()); ++ const Sci::Position endGoal = (idleStyling >= SC_IDLESTYLING_AFTERVISIBLE) ? + pdoc->Length() : posAfterArea; +- const int posAfterMax = PositionAfterMaxStyling(endGoal, false); ++ const Sci::Position posAfterMax = PositionAfterMaxStyling(endGoal, false); + pdoc->StyleToAdjustingLineDuration(posAfterMax); + if (pdoc->GetEndStyled() >= endGoal) { + needIdleStyling = false; +@@ -5115,7 +5116,7 @@ + workNeeded.Reset(); + } + +-void Editor::QueueIdleWork(WorkNeeded::workItems items, int upTo) { ++void Editor::QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) { + workNeeded.Need(items, upTo); + } + +@@ -5160,7 +5161,7 @@ + } + } + +-void Editor::SetBraceHighlight(Position pos0, Position pos1, int matchStyle) { ++void Editor::SetBraceHighlight(Sci::Position pos0, Sci::Position pos1, int matchStyle) { + if ((pos0 != braces[0]) || (pos1 != braces[1]) || (matchStyle != bracesMatchStyle)) { + if ((braces[0] != pos0) || (matchStyle != bracesMatchStyle)) { + CheckForChangeOutsidePaint(Range(braces[0])); +@@ -5179,11 +5180,11 @@ + } + } + +-void Editor::SetAnnotationHeights(int start, int end) { ++void Editor::SetAnnotationHeights(Sci::Line start, Sci::Line end) { + if (vs.annotationVisible) { + RefreshStyleData(); + bool changedHeight = false; +- for (int line=start; line<end && line<pdoc->LinesTotal(); line++) { ++ for (Sci::Line line=start; line<end && line<pdoc->LinesTotal(); line++) { + int linesWrapped = 1; + if (Wrapping()) { + AutoSurface surface(this); +@@ -5218,8 +5219,8 @@ + targetStart = 0; + targetEnd = 0; + +- braces[0] = invalidPosition; +- braces[1] = invalidPosition; ++ braces[0] = Sci::invalidPosition; ++ braces[1] = Sci::invalidPosition; + + vs.ReleaseAllExtendedStyles(); + +@@ -5232,8 +5233,8 @@ + view.llc.Deallocate(); + NeedWrapping(); + +- hotspot = Range(invalidPosition); +- hoverIndicatorPos = invalidPosition; ++ hotspot = Range(Sci::invalidPosition); ++ hoverIndicatorPos = Sci::invalidPosition; + + view.ClearAllTabstops(); + +@@ -5248,7 +5249,7 @@ + vs.annotationVisible = visible; + if (changedFromOrToHidden) { + int dir = vs.annotationVisible ? 1 : -1; +- for (int line=0; line<pdoc->LinesTotal(); line++) { ++ for (Sci::Line line=0; line<pdoc->LinesTotal(); line++) { + int annotationLines = pdoc->AnnotationLines(line); + if (annotationLines > 0) { + cs.SetHeight(line, cs.GetHeight(line) + annotationLines * dir); +@@ -5262,8 +5263,8 @@ + /** + * Recursively expand a fold, making lines visible except where they have an unexpanded parent. + */ +-int Editor::ExpandLine(int line) { +- int lineMaxSubord = pdoc->GetLastChild(line); ++Sci::Line Editor::ExpandLine(Sci::Line line) { ++ Sci::Line lineMaxSubord = pdoc->GetLastChild(line); + line++; + while (line <= lineMaxSubord) { + cs.SetVisible(line, line, true); +@@ -5280,13 +5281,13 @@ + return lineMaxSubord; + } + +-void Editor::SetFoldExpanded(int lineDoc, bool expanded) { ++void Editor::SetFoldExpanded(Sci::Line lineDoc, bool expanded) { + if (cs.SetExpanded(lineDoc, expanded)) { + RedrawSelMargin(); + } + } + +-void Editor::FoldLine(int line, int action) { ++void Editor::FoldLine(Sci::Line line, int action) { + if (line >= 0) { + if (action == SC_FOLDACTION_TOGGLE) { + if ((pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) == 0) { +@@ -5298,12 +5299,12 @@ + } + + if (action == SC_FOLDACTION_CONTRACT) { +- int lineMaxSubord = pdoc->GetLastChild(line); ++ Sci::Line lineMaxSubord = pdoc->GetLastChild(line); + if (lineMaxSubord > line) { + cs.SetExpanded(line, 0); + cs.SetVisible(line + 1, lineMaxSubord, false); + +- int lineCurrent = pdoc->LineFromPosition(sel.MainCaret()); ++ Sci::Line lineCurrent = pdoc->LineFromPosition(sel.MainCaret()); + if (lineCurrent > line && lineCurrent <= lineMaxSubord) { + // This does not re-expand the fold + EnsureCaretVisible(); +@@ -5324,7 +5325,7 @@ + } + } + +-void Editor::FoldExpand(int line, int action, int level) { ++void Editor::FoldExpand(Sci::Line line, int action, int level) { + bool expanding = action == SC_FOLDACTION_EXPAND; + if (action == SC_FOLDACTION_TOGGLE) { + expanding = !cs.GetExpanded(line); +@@ -5336,7 +5337,7 @@ + if (expanding && (cs.HiddenLines() == 0)) + // Nothing to do + return; +- int lineMaxSubord = pdoc->GetLastChild(line, LevelNumber(level)); ++ Sci::Line lineMaxSubord = pdoc->GetLastChild(line, LevelNumber(level)); + line++; + cs.SetVisible(line, lineMaxSubord, expanding); + while (line <= lineMaxSubord) { +@@ -5350,8 +5351,8 @@ + Redraw(); + } + +-int Editor::ContractedFoldNext(int lineStart) const { +- for (int line = lineStart; line<pdoc->LinesTotal();) { ++Sci::Line Editor::ContractedFoldNext(Sci::Line lineStart) const { ++ for (Sci::Line line = lineStart; line<pdoc->LinesTotal();) { + if (!cs.GetExpanded(line) && (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG)) + return line; + line = cs.ContractedNext(line+1); +@@ -5366,7 +5367,7 @@ + * Recurse up from this line to find any folds that prevent this line from being visible + * and unfold them all. + */ +-void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { ++void Editor::EnsureLineVisible(Sci::Line lineDoc, bool enforcePolicy) { + + // In case in need of wrapping to ensure DisplayFromDoc works. + if (lineDoc >= wrapPending.start) +@@ -5374,12 +5375,12 @@ + + if (!cs.GetVisible(lineDoc)) { + // Back up to find a non-blank line +- int lookLine = lineDoc; ++ Sci::Line lookLine = lineDoc; + int lookLineLevel = pdoc->GetLevel(lookLine); + while ((lookLine > 0) && (lookLineLevel & SC_FOLDLEVELWHITEFLAG)) { + lookLineLevel = pdoc->GetLevel(--lookLine); + } +- int lineParent = pdoc->GetFoldParent(lookLine); ++ Sci::Line lineParent = pdoc->GetFoldParent(lookLine); + if (lineParent < 0) { + // Backed up to a top level line, so try to find parent of initial line + lineParent = pdoc->GetFoldParent(lineDoc); +@@ -5396,7 +5397,7 @@ + Redraw(); + } + if (enforcePolicy) { +- int lineDisplay = cs.DisplayFromDoc(lineDoc); ++ Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); + if (visiblePolicy & VISIBLE_SLOP) { + if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) { + SetTopLine(Platform::Clamp(lineDisplay - visibleSlop, 0, MaxScrollPos())); +@@ -5420,7 +5421,7 @@ + + void Editor::FoldAll(int action) { + pdoc->EnsureStyledTo(pdoc->Length()); +- int maxLine = pdoc->LinesTotal(); ++ Sci::Line maxLine = pdoc->LinesTotal(); + bool expanding = action == SC_FOLDACTION_EXPAND; + if (action == SC_FOLDACTION_TOGGLE) { + // Discover current state +@@ -5445,7 +5446,7 @@ + if ((level & SC_FOLDLEVELHEADERFLAG) && + (SC_FOLDLEVELBASE == LevelNumber(level))) { + SetFoldExpanded(line, false); +- int lineMaxSubord = pdoc->GetLastChild(line, -1); ++ Sci::Line lineMaxSubord = pdoc->GetLastChild(line, -1); + if (lineMaxSubord > line) { + cs.SetVisible(line + 1, lineMaxSubord, false); + } +@@ -5456,7 +5457,7 @@ + Redraw(); + } + +-void Editor::FoldChanged(int line, int levelNow, int levelPrev) { ++void Editor::FoldChanged(Sci::Line line, int levelNow, int levelPrev) { + if (levelNow & SC_FOLDLEVELHEADERFLAG) { + if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { + // Adding a fold point. +@@ -5466,7 +5467,7 @@ + FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev); + } + } else if (levelPrev & SC_FOLDLEVELHEADERFLAG) { +- const int prevLine = line - 1; ++ const Sci::Line prevLine = line - 1; + const int prevLineLevel = pdoc->GetLevel(prevLine); + + // Combining two blocks where the first block is collapsed (e.g. by deleting the line(s) which separate(s) the two blocks) +@@ -5487,7 +5488,7 @@ + (LevelNumber(levelPrev) > LevelNumber(levelNow))) { + if (cs.HiddenLines()) { + // See if should still be hidden +- int parentLine = pdoc->GetFoldParent(line); ++ Sci::Line parentLine = pdoc->GetFoldParent(line); + if ((parentLine < 0) || (cs.GetExpanded(parentLine) && cs.GetVisible(parentLine))) { + cs.SetVisible(line, line, true); + SetScrollBars(); +@@ -5499,18 +5500,18 @@ + // Combining two blocks where the first one is collapsed (e.g. by adding characters in the line which separates the two blocks) + if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && (LevelNumber(levelPrev) < LevelNumber(levelNow))) { + if (cs.HiddenLines()) { +- const int parentLine = pdoc->GetFoldParent(line); ++ const Sci::Line parentLine = pdoc->GetFoldParent(line); + if (!cs.GetExpanded(parentLine) && cs.GetVisible(line)) + FoldLine(parentLine, SC_FOLDACTION_EXPAND); + } + } + } + +-void Editor::NeedShown(int pos, int len) { ++void Editor::NeedShown(Sci::Position pos, Sci::Position len) { + if (foldAutomatic & SC_AUTOMATICFOLD_SHOW) { +- int lineStart = pdoc->LineFromPosition(pos); +- int lineEnd = pdoc->LineFromPosition(pos+len); +- for (int line = lineStart; line <= lineEnd; line++) { ++ Sci::Line lineStart = pdoc->LineFromPosition(pos); ++ Sci::Line lineEnd = pdoc->LineFromPosition(pos+len); ++ for (Sci::Line line = lineStart; line <= lineEnd; line++) { + EnsureLineVisible(line, false); + } + } else { +@@ -5518,9 +5519,9 @@ + } + } + +-int Editor::GetTag(char *tagValue, int tagNumber) { ++Sci::Position Editor::GetTag(char *tagValue, int tagNumber) { + const char *text = 0; +- int length = 0; ++ Sci::Position length = 0; + if ((tagNumber >= 1) && (tagNumber <= 9)) { + char name[3] = "\\?"; + name[1] = static_cast<char>(tagNumber + '0'); +@@ -5536,7 +5537,7 @@ + return length; + } + +-int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) { ++Sci::Position Editor::ReplaceTarget(bool replacePatterns, const char *text, Sci::Position length) { + UndoGroup ug(pdoc); + if (length == -1) + length = istrlen(text); +@@ -5549,7 +5550,7 @@ + if (targetStart != targetEnd) + pdoc->DeleteChars(targetStart, targetEnd - targetStart); + targetEnd = targetStart; +- const int lengthInserted = pdoc->InsertString(targetStart, text, length); ++ const Sci::Position lengthInserted = pdoc->InsertString(targetStart, text, length); + targetEnd = targetStart + lengthInserted; + return length; + } +@@ -5577,15 +5578,15 @@ + } + } + +-void Editor::AddStyledText(char *buffer, int appendLength) { ++void Editor::AddStyledText(char *buffer, Sci::Position appendLength) { + // The buffer consists of alternating character bytes and style bytes +- int textLength = appendLength / 2; ++ Sci::Position textLength = appendLength / 2; + std::string text(textLength, '\0'); +- int i; ++ Sci::Position i; + for (i = 0; i < textLength; i++) { + text[i] = buffer[i*2]; + } +- const int lengthInserted = pdoc->InsertString(CurrentPosition(), text.c_str(), textLength); ++ const Sci::Position lengthInserted = pdoc->InsertString(CurrentPosition(), text.c_str(), textLength); + for (i = 0; i < textLength; i++) { + text[i] = buffer[i*2+1]; + } +@@ -5854,14 +5855,14 @@ + break; + + case SCI_GETLINE: { // Risk of overwriting the end of the buffer +- int lineStart = pdoc->LineStart(static_cast<int>(wParam)); +- int lineEnd = pdoc->LineStart(static_cast<int>(wParam + 1)); ++ Sci::Position lineStart = pdoc->LineStart(static_cast<Sci::Line>(wParam)); ++ Sci::Position lineEnd = pdoc->LineStart(static_cast<Sci::Line>(wParam + 1)); + if (lParam == 0) { + return lineEnd - lineStart; + } + char *ptr = CharPtrFromSPtr(lParam); +- int iPlace = 0; +- for (int iChar = lineStart; iChar < lineEnd; iChar++) { ++ Sci::Position iPlace = 0; ++ for (Sci::Position iChar = lineStart; iChar < lineEnd; iChar++) { + ptr[iPlace++] = pdoc->CharAt(iChar); + } + return iPlace; +@@ -5877,8 +5878,8 @@ + return !pdoc->IsSavePoint(); + + case SCI_SETSEL: { +- int nStart = static_cast<int>(wParam); +- int nEnd = static_cast<int>(lParam); ++ Sci::Position nStart = static_cast<Sci::Position>(wParam); ++ Sci::Position nEnd = static_cast<Sci::Position>(lParam); + if (nEnd < 0) + nEnd = pdoc->Length(); + if (nStart < 0) +@@ -5919,7 +5920,7 @@ + wParam = pdoc->LineFromPosition(SelectionStart().Position()); + if (wParam == 0) + return 0; // Even if there is no text, there is a first line that starts at 0 +- if (static_cast<int>(wParam) > pdoc->LinesTotal()) ++ if (static_cast<Sci::Line>(wParam) > pdoc->LinesTotal()) + return -1; + //if (wParam > pdoc->LineFromPosition(pdoc->Length())) // Useful test, anyway... + // return -1; +@@ -5938,7 +5939,7 @@ + UndoGroup ug(pdoc); + ClearSelection(); + char *replacement = CharPtrFromSPtr(lParam); +- const int lengthInserted = pdoc->InsertString( ++ const Sci::Position lengthInserted = pdoc->InsertString( + sel.MainCaret(), replacement, istrlen(replacement)); + SetEmptySelection(sel.MainCaret() + lengthInserted); + EnsureCaretVisible(); +@@ -5986,15 +5987,15 @@ + + case SCI_REPLACETARGET: + PLATFORM_ASSERT(lParam); +- return ReplaceTarget(false, CharPtrFromSPtr(lParam), static_cast<int>(wParam)); ++ return ReplaceTarget(false, CharPtrFromSPtr(lParam), static_cast<Sci::Position>(wParam)); + + case SCI_REPLACETARGETRE: + PLATFORM_ASSERT(lParam); +- return ReplaceTarget(true, CharPtrFromSPtr(lParam), static_cast<int>(wParam)); ++ return ReplaceTarget(true, CharPtrFromSPtr(lParam), static_cast<Sci::Position>(wParam)); + + case SCI_SEARCHINTARGET: + PLATFORM_ASSERT(lParam); +- return SearchInTarget(CharPtrFromSPtr(lParam), static_cast<int>(wParam)); ++ return SearchInTarget(CharPtrFromSPtr(lParam), static_cast<Sci::Position>(wParam)); + + case SCI_SETSEARCHFLAGS: + searchFlags = static_cast<int>(wParam); +@@ -6016,8 +6017,8 @@ + return Platform::Clamp(pdoc->GetRelativePosition(static_cast<int>(wParam), static_cast<int>(lParam)), 0, pdoc->Length()); + + case SCI_LINESCROLL: +- ScrollTo(topLine + static_cast<int>(lParam)); +- HorizontalScrollTo(xOffset + static_cast<int>(wParam)* static_cast<int>(vs.spaceWidth)); ++ ScrollTo(topLine + static_cast<Sci::Line>(lParam)); ++ HorizontalScrollTo(xOffset + static_cast<int>(wParam) * static_cast<int>(vs.spaceWidth)); + return 1; + + case SCI_SETXOFFSET: +@@ -6072,7 +6073,7 @@ + if (lParam == 0) + return 0; + Sci_TextRange *tr = reinterpret_cast<Sci_TextRange *>(lParam); +- int cpMax = static_cast<int>(tr->chrg.cpMax); ++ Sci::Position cpMax = static_cast<Sci::Position>(tr->chrg.cpMax); + if (cpMax == -1) + cpMax = pdoc->Length(); + PLATFORM_ASSERT(cpMax <= pdoc->Length()); +@@ -6113,26 +6114,26 @@ + case SCI_ADDTEXT: { + if (lParam == 0) + return 0; +- const int lengthInserted = pdoc->InsertString( +- CurrentPosition(), CharPtrFromSPtr(lParam), static_cast<int>(wParam)); ++ const Sci::Position lengthInserted = pdoc->InsertString( ++ CurrentPosition(), CharPtrFromSPtr(lParam), static_cast<Sci::Position>(wParam)); + SetEmptySelection(sel.MainCaret() + lengthInserted); + return 0; + } + + case SCI_ADDSTYLEDTEXT: + if (lParam) +- AddStyledText(CharPtrFromSPtr(lParam), static_cast<int>(wParam)); ++ AddStyledText(CharPtrFromSPtr(lParam), static_cast<Sci::Position>(wParam)); + return 0; + + case SCI_INSERTTEXT: { + if (lParam == 0) + return 0; +- int insertPos = static_cast<int>(wParam); ++ Sci::Position insertPos = static_cast<Sci::Position>(wParam); + if (static_cast<int>(wParam) == -1) + insertPos = CurrentPosition(); +- int newCurrent = CurrentPosition(); ++ Sci::Position newCurrent = CurrentPosition(); + char *sz = CharPtrFromSPtr(lParam); +- const int lengthInserted = pdoc->InsertString(insertPos, sz, istrlen(sz)); ++ const Sci::Position lengthInserted = pdoc->InsertString(insertPos, sz, istrlen(sz)); + if (newCurrent > insertPos) + newCurrent += lengthInserted; + SetEmptySelection(newCurrent); +@@ -6221,11 +6222,11 @@ + return pdoc->Length(); + + case SCI_ALLOCATE: +- pdoc->Allocate(static_cast<int>(wParam)); ++ pdoc->Allocate(static_cast<Sci::Position>(wParam)); + break; + + case SCI_GETCHARAT: +- return pdoc->CharAt(static_cast<int>(wParam)); ++ return pdoc->CharAt(static_cast<Sci::Position>(wParam)); + + case SCI_SETCURRENTPOS: + if (sel.IsRectangular()) { +@@ -6233,7 +6234,7 @@ + SetRectangularRange(); + Redraw(); + } else { +- SetSelection(static_cast<int>(wParam), sel.MainAnchor()); ++ SetSelection(static_cast<Sci::Position>(wParam), sel.MainAnchor()); + } + break; + +@@ -6242,11 +6243,11 @@ + + case SCI_SETANCHOR: + if (sel.IsRectangular()) { +- sel.Rectangular().anchor.SetPosition(static_cast<int>(wParam)); ++ sel.Rectangular().anchor.SetPosition(static_cast<Sci::Position>(wParam)); + SetRectangularRange(); + Redraw(); + } else { +- SetSelection(sel.MainCaret(), static_cast<int>(wParam)); ++ SetSelection(sel.MainCaret(), static_cast<Sci::Position>(wParam)); + } + break; + +@@ -6254,14 +6255,14 @@ + return sel.IsRectangular() ? sel.Rectangular().anchor.Position() : sel.MainAnchor(); + + case SCI_SETSELECTIONSTART: +- SetSelection(Platform::Maximum(sel.MainCaret(), static_cast<int>(wParam)), static_cast<int>(wParam)); ++ SetSelection(std::max(sel.MainCaret(), static_cast<Sci::Position>(wParam)), static_cast<Sci::Position>(wParam)); + break; + + case SCI_GETSELECTIONSTART: + return sel.LimitsForRectangularElseMain().start.Position(); + + case SCI_SETSELECTIONEND: +- SetSelection(static_cast<int>(wParam), Platform::Minimum(sel.MainAnchor(), static_cast<int>(wParam))); ++ SetSelection(static_cast<Sci::Position>(wParam), Platform::Minimum(sel.MainAnchor(), static_cast<Sci::Position>(wParam))); + break; + + case SCI_GETSELECTIONEND: +@@ -6384,16 +6385,16 @@ + break; + + case SCI_GETCURLINE: { +- int lineCurrentPos = pdoc->LineFromPosition(sel.MainCaret()); +- int lineStart = pdoc->LineStart(lineCurrentPos); +- unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1); ++ const Sci::Line lineCurrentPos = pdoc->LineFromPosition(sel.MainCaret()); ++ const Sci::Position lineStart = pdoc->LineStart(lineCurrentPos); ++ const Sci::Position lineEnd = pdoc->LineStart(lineCurrentPos + 1); + if (lParam == 0) { + return 1 + lineEnd - lineStart; + } + PLATFORM_ASSERT(wParam > 0); + char *ptr = CharPtrFromSPtr(lParam); + unsigned int iPlace = 0; +- for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) { ++ for (Sci::Position iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) { + ptr[iPlace++] = pdoc->CharAt(iChar); + } + ptr[iPlace] = '\0'; +diff -r 1788f6795302 -r a0f26eaf474d src/Editor.h +--- a/src/Editor.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/Editor.h Fri Mar 31 18:19:38 2017 +1100 +@@ -47,14 +47,14 @@ + workUpdateUI=2 + }; + enum workItems items; +- Position upTo; ++ Sci::Position upTo; + + WorkNeeded() : items(workNone), upTo(0) {} + void Reset() { + items = workNone; + upTo = 0; + } +- void Need(workItems items_, Position pos) { ++ void Need(workItems items_, Sci::Position pos) { + if ((items_ & workStyle) && (upTo < pos)) + upTo = pos; + items = static_cast<workItems>(items | items_); +@@ -115,8 +115,8 @@ + struct WrapPending { + // The range of lines that need to be wrapped + enum { lineLarge = 0x7ffffff }; +- int start; // When there are wraps pending, will be in document range +- int end; // May be lineLarge to indicate all of document after start ++ Sci::Line start; // When there are wraps pending, will be in document range ++ Sci::Line end; // May be lineLarge to indicate all of document after start + WrapPending() { + start = lineLarge; + end = lineLarge; +@@ -125,14 +125,14 @@ + start = lineLarge; + end = lineLarge; + } +- void Wrapped(int line) { ++ void Wrapped(Sci::Line line) { + if (start == line) + start++; + } + bool NeedsWrap() const { + return start < end; + } +- bool AddRange(int lineStart, int lineEnd) { ++ bool AddRange(Sci::Line lineStart, Sci::Line lineEnd) { + const bool neededWrap = NeedsWrap(); + bool changed = false; + if (start > lineStart) { +@@ -211,19 +211,19 @@ + enum { ddNone, ddInitial, ddDragging } inDragDrop; + bool dropWentOutside; + SelectionPosition posDrop; +- int hotSpotClickPos; ++ Sci::Position hotSpotClickPos; + int lastXChosen; +- int lineAnchorPos; +- int originalAnchorPos; +- int wordSelectAnchorStartPos; +- int wordSelectAnchorEndPos; +- int wordSelectInitialCaretPos; +- int targetStart; +- int targetEnd; ++ Sci::Position lineAnchorPos; ++ Sci::Position originalAnchorPos; ++ Sci::Position wordSelectAnchorStartPos; ++ Sci::Position wordSelectAnchorEndPos; ++ Sci::Position wordSelectInitialCaretPos; ++ Sci::Position targetStart; ++ Sci::Position targetEnd; + int searchFlags; +- int topLine; +- int posTopLine; +- int lengthForEncode; ++ Sci::Line topLine; ++ Sci::Position posTopLine; ++ Sci::Position lengthForEncode; + + int needUpdateUI; + +@@ -249,7 +249,7 @@ + int visiblePolicy; + int visibleSlop; + +- int searchAnchor; ++ Sci::Position searchAnchor; + + bool recordingMacro; + +@@ -276,38 +276,38 @@ + // scroll views where it will be equivalent to the current scroll position. + virtual Point GetVisibleOriginInMain() const; + PointDocument DocumentPointFromView(Point ptView) const; // Convert a point from view space to document +- int TopLineOfMain() const; // Return the line at Main's y coordinate 0 ++ Sci::Line TopLineOfMain() const; // Return the line at Main's y coordinate 0 + virtual PRectangle GetClientRectangle() const; + virtual PRectangle GetClientDrawingRectangle(); + PRectangle GetTextRectangle() const; + +- virtual int LinesOnScreen() const; +- int LinesToScroll() const; +- int MaxScrollPos() const; ++ virtual Sci::Line LinesOnScreen() const; ++ Sci::Line LinesToScroll() const; ++ Sci::Line MaxScrollPos() const; + SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const; + Point LocationFromPosition(SelectionPosition pos, PointEnd pe=peDefault); +- Point LocationFromPosition(int pos, PointEnd pe=peDefault); +- int XFromPosition(int pos); ++ Point LocationFromPosition(Sci::Position pos, PointEnd pe=peDefault); ++ int XFromPosition(Sci::Position pos); + int XFromPosition(SelectionPosition sp); + SelectionPosition SPositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false, bool virtualSpace=true); +- int PositionFromLocation(Point pt, bool canReturnInvalid = false, bool charPosition = false); +- SelectionPosition SPositionFromLineX(int lineDoc, int x); +- int PositionFromLineX(int line, int x); +- int LineFromLocation(Point pt) const; +- void SetTopLine(int topLineNew); ++ Sci::Position PositionFromLocation(Point pt, bool canReturnInvalid = false, bool charPosition = false); ++ SelectionPosition SPositionFromLineX(Sci::Line lineDoc, int x); ++ Sci::Position PositionFromLineX(Sci::Line line, int x); ++ Sci::Line LineFromLocation(Point pt) const; ++ void SetTopLine(Sci::Line topLineNew); + + virtual bool AbandonPaint(); + virtual void RedrawRect(PRectangle rc); + virtual void DiscardOverdraw(); + virtual void Redraw(); +- void RedrawSelMargin(int line=-1, bool allAfter=false); ++ void RedrawSelMargin(Sci::Line line=-1, bool allAfter=false); + PRectangle RectangleFromRange(Range r, int overlap); +- void InvalidateRange(int start, int end); ++ void InvalidateRange(Sci::Position start, Sci::Position end); + + bool UserVirtualSpace() const { + return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0); + } +- int CurrentPosition() const; ++ Sci::Position CurrentPosition() const; + bool SelectionEmpty() const; + SelectionPosition SelectionStart(); + SelectionPosition SelectionEnd(); +@@ -316,39 +316,39 @@ + void InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection=false); + void InvalidateWholeSelection(); + void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_); +- void SetSelection(int currentPos_, int anchor_); ++ void SetSelection(Sci::Position currentPos_, Sci::Position anchor_); + void SetSelection(SelectionPosition currentPos_); + void SetSelection(int currentPos_); + void SetEmptySelection(SelectionPosition currentPos_); +- void SetEmptySelection(int currentPos_); ++ void SetEmptySelection(Sci::Position currentPos_); + enum AddNumber { addOne, addEach }; + void MultipleSelectAdd(AddNumber addNumber); +- bool RangeContainsProtected(int start, int end) const; ++ bool RangeContainsProtected(Sci::Position start, Sci::Position end) const; + bool SelectionContainsProtected(); +- int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; +- SelectionPosition MovePositionOutsideChar(SelectionPosition pos, int moveDir, bool checkLineEnd=true) const; ++ Sci::Position MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd=true) const; ++ SelectionPosition MovePositionOutsideChar(SelectionPosition pos, Sci::Position moveDir, bool checkLineEnd=true) const; + void MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, bool ensureVisible); + void MovePositionTo(SelectionPosition newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); +- void MovePositionTo(int newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); ++ void MovePositionTo(Sci::Position newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); + SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir); +- SelectionPosition MovePositionSoVisible(int pos, int moveDir); ++ SelectionPosition MovePositionSoVisible(Sci::Position pos, int moveDir); + Point PointMainCaret(); + void SetLastXChosen(); + +- void ScrollTo(int line, bool moveThumb=true); +- virtual void ScrollText(int linesToMove); ++ void ScrollTo(Sci::Line line, bool moveThumb=true); ++ virtual void ScrollText(Sci::Line linesToMove); + void HorizontalScrollTo(int xPos); + void VerticalCentreCaret(); + void MoveSelectedLines(int lineDelta); + void MoveSelectedLinesUp(); + void MoveSelectedLinesDown(); + void MoveCaretInsideView(bool ensureVisible=true); +- int DisplayFromPosition(int pos); ++ Sci::Line DisplayFromPosition(Sci::Position pos); + + struct XYScrollPosition { + int xOffset; +- int topLine; +- XYScrollPosition(int xOffset_, int topLine_) : xOffset(xOffset_), topLine(topLine_) {} ++ Sci::Line topLine; ++ XYScrollPosition(int xOffset_, Sci::Line topLine_) : xOffset(xOffset_), topLine(topLine_) {} + bool operator==(const XYScrollPosition &other) const { + return (xOffset == other.xOffset) && (topLine == other.topLine); + } +@@ -370,8 +370,8 @@ + virtual void UpdateSystemCaret(); + + bool Wrapping() const; +- void NeedWrapping(int docLineStart=0, int docLineEnd=WrapPending::lineLarge); +- bool WrapOneLine(Surface *surface, int lineToWrap); ++ void NeedWrapping(Sci::Line docLineStart=0, Sci::Line docLineEnd=WrapPending::lineLarge); ++ bool WrapOneLine(Surface *surface, Sci::Line lineToWrap); + enum wrapScope {wsAll, wsVisible, wsIdle}; + bool WrapLines(enum wrapScope ws); + void LinesJoin(); +@@ -385,13 +385,13 @@ + + virtual void SetVerticalScrollPos() = 0; + virtual void SetHorizontalScrollPos() = 0; +- virtual bool ModifyScrollBars(int nMax, int nPage) = 0; ++ virtual bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) = 0; + virtual void ReconfigureScrollBars(); + void SetScrollBars(); + void ChangeSize(); + + void FilterSelections(); +- int RealizeVirtualSpace(int position, unsigned int virtualSpace); ++ Sci::Position RealizeVirtualSpace(Sci::Position position, Sci::Position virtualSpace); + SelectionPosition RealizeVirtualSpace(const SelectionPosition &position); + void AddChar(char ch); + virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); +@@ -403,7 +403,7 @@ + void ClearAll(); + void ClearDocumentStyle(); + void Cut(); +- void PasteRectangular(SelectionPosition pos, const char *ptr, int len); ++ void PasteRectangular(SelectionPosition pos, const char *ptr, Sci::Position len); + virtual void Copy() = 0; + virtual void CopyAllowLine(); + virtual bool CanPaste(); +@@ -421,26 +421,26 @@ + virtual void SetCtrlID(int identifier); + virtual int GetCtrlID() { return ctrlID; } + virtual void NotifyParent(SCNotification scn) = 0; +- virtual void NotifyStyleToNeeded(int endStyleNeeded); ++ virtual void NotifyStyleToNeeded(Sci::Position endStyleNeeded); + void NotifyChar(int ch); + void NotifySavePoint(bool isSavePoint); + void NotifyModifyAttempt(); + virtual void NotifyDoubleClick(Point pt, int modifiers); + virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); +- void NotifyHotSpotClicked(int position, int modifiers); +- void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt); +- void NotifyHotSpotDoubleClicked(int position, int modifiers); +- void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt); +- void NotifyHotSpotReleaseClick(int position, int modifiers); +- void NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt); ++ void NotifyHotSpotClicked(Sci::Position position, int modifiers); ++ void NotifyHotSpotClicked(Sci::Position position, bool shift, bool ctrl, bool alt); ++ void NotifyHotSpotDoubleClicked(Sci::Position position, int modifiers); ++ void NotifyHotSpotDoubleClicked(Sci::Position position, bool shift, bool ctrl, bool alt); ++ void NotifyHotSpotReleaseClick(Sci::Position position, int modifiers); ++ void NotifyHotSpotReleaseClick(Sci::Position position, bool shift, bool ctrl, bool alt); + bool NotifyUpdateUI(); + void NotifyPainted(); +- void NotifyIndicatorClick(bool click, int position, int modifiers); +- void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt); ++ void NotifyIndicatorClick(bool click, Sci::Position position, int modifiers); ++ void NotifyIndicatorClick(bool click, Sci::Position position, bool shift, bool ctrl, bool alt); + bool NotifyMarginClick(Point pt, int modifiers); + bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt); + bool NotifyMarginRightClick(Point pt, int modifiers); +- void NotifyNeedShown(int pos, int len); ++ void NotifyNeedShown(Sci::Position pos, Sci::Position len); + void NotifyDwelling(Point pt, bool state); + void NotifyZoom(); + +@@ -449,7 +449,7 @@ + void CheckModificationForWrap(DocModification mh); + void NotifyModified(Document *document, DocModification mh, void *userData); + void NotifyDeleted(Document *document, void *userData); +- void NotifyStyleNeeded(Document *doc, void *userData, int endPos); ++ void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos); + void NotifyLexerChanged(Document *doc, void *userData); + void NotifyErrorOccurred(Document *doc, void *userData, int status); + void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); +@@ -466,11 +466,11 @@ + SelectionPosition PositionUpOrDown(SelectionPosition spStart, int direction, int lastX); + void CursorUpOrDown(int direction, Selection::selTypes selt); + void ParaUpOrDown(int direction, Selection::selTypes selt); +- Range RangeDisplayLine(int lineVisible); +- int StartEndDisplayLine(int pos, bool start); +- int VCHomeDisplayPosition(int position); +- int VCHomeWrapPosition(int position); +- int LineEndWrapPosition(int position); ++ Range RangeDisplayLine(Sci::Line lineVisible); ++ Sci::Position StartEndDisplayLine(Sci::Position pos, bool start); ++ Sci::Position VCHomeDisplayPosition(Sci::Position position); ++ Sci::Position VCHomeWrapPosition(Sci::Position position); ++ Sci::Position LineEndWrapPosition(Sci::Position position); + int HorizontalMove(unsigned int iMessage); + int DelWordOrLine(unsigned int iMessage); + virtual int KeyCommand(unsigned int iMessage); +@@ -484,13 +484,13 @@ + long FindText(uptr_t wParam, sptr_t lParam); + void SearchAnchor(); + long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); +- long SearchInTarget(const char *text, int length); +- void GoToLine(int lineNo); ++ long SearchInTarget(const char *text, Sci::Position length); ++ void GoToLine(Sci::Line lineNo); + + virtual void CopyToClipboard(const SelectionText &selectedText) = 0; +- std::string RangeText(int start, int end) const; ++ std::string RangeText(Sci::Position start, Sci::Position end) const; + void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false); +- void CopyRangeToClipboard(int start, int end); ++ void CopyRangeToClipboard(Sci::Position start, Sci::Position end); + void CopyText(int length, const char *text); + void SetDragPosition(SelectionPosition newPos); + virtual void DisplayCursor(Window::Cursor c); +@@ -499,13 +499,13 @@ + void DropAt(SelectionPosition position, const char *value, size_t lengthValue, bool moving, bool rectangular); + void DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular); + /** PositionInSelection returns true if position in selection. */ +- bool PositionInSelection(int pos); ++ bool PositionInSelection(Sci::Position pos); + bool PointInSelection(Point pt); + bool PointInSelMargin(Point pt) const; + Window::Cursor GetMarginCursor(Point pt) const; +- void TrimAndSetSelection(int currentPos_, int anchor_); +- void LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine); +- void WordSelection(int pos); ++ void TrimAndSetSelection(Sci::Position currentPos_, Sci::Position anchor_); ++ void LineSelection(Sci::Position lineCurrentPos_, Sci::Position lineAnchorPos_, bool wholeLine); ++ void WordSelection(Sci::Position pos); + void DwellEnd(bool mouseMoved); + void MouseLeave(); + virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); +@@ -529,49 +529,49 @@ + virtual bool HaveMouseCapture() = 0; + void SetFocusState(bool focusState); + +- int PositionAfterArea(PRectangle rcArea) const; +- void StyleToPositionInView(Position pos); +- int PositionAfterMaxStyling(int posMax, bool scrolling) const; ++ Sci::Position PositionAfterArea(PRectangle rcArea) const; ++ void StyleToPositionInView(Sci::Position pos); ++ Sci::Position PositionAfterMaxStyling(Sci::Position posMax, bool scrolling) const; + void StartIdleStyling(bool truncatedLastStyling); + void StyleAreaBounded(PRectangle rcArea, bool scrolling); + void IdleStyling(); + virtual void IdleWork(); +- virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo=0); ++ virtual void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo=0); + + virtual bool PaintContains(PRectangle rc); + bool PaintContainsMargin(); + void CheckForChangeOutsidePaint(Range r); +- void SetBraceHighlight(Position pos0, Position pos1, int matchStyle); ++ void SetBraceHighlight(Sci::Position pos0, Sci::Position pos1, int matchStyle); + +- void SetAnnotationHeights(int start, int end); ++ void SetAnnotationHeights(Sci::Line start, Sci::Line end); + virtual void SetDocPointer(Document *document); + + void SetAnnotationVisible(int visible); + +- int ExpandLine(int line); +- void SetFoldExpanded(int lineDoc, bool expanded); +- void FoldLine(int line, int action); +- void FoldExpand(int line, int action, int level); +- int ContractedFoldNext(int lineStart) const; +- void EnsureLineVisible(int lineDoc, bool enforcePolicy); +- void FoldChanged(int line, int levelNow, int levelPrev); +- void NeedShown(int pos, int len); ++ Sci::Line ExpandLine(Sci::Line line); ++ void SetFoldExpanded(Sci::Line lineDoc, bool expanded); ++ void FoldLine(Sci::Line line, int action); ++ void FoldExpand(Sci::Line line, int action, int level); ++ Sci::Line ContractedFoldNext(Sci::Line lineStart) const; ++ void EnsureLineVisible(Sci::Line lineDoc, bool enforcePolicy); ++ void FoldChanged(Sci::Line line, int levelNow, int levelPrev); ++ void NeedShown(Sci::Position pos, Sci::Position len); + void FoldAll(int action); + +- int GetTag(char *tagValue, int tagNumber); +- int ReplaceTarget(bool replacePatterns, const char *text, int length=-1); ++ Sci::Position GetTag(char *tagValue, int tagNumber); ++ Sci::Position ReplaceTarget(bool replacePatterns, const char *text, Sci::Position length=-1); + +- bool PositionIsHotspot(int position) const; ++ bool PositionIsHotspot(Sci::Position position) const; + bool PointIsHotspot(Point pt); + void SetHotSpotRange(Point *pt); + Range GetHotSpotRange() const; +- void SetHoverIndicatorPosition(int position); ++ void SetHoverIndicatorPosition(Sci::Position position); + void SetHoverIndicatorPoint(Point pt); + + int CodePage() const; + virtual bool ValidCodePage(int /* codePage */) const { return true; } + int WrapCount(int line); +- void AddStyledText(char *buffer, int appendLength); ++ void AddStyledText(char *buffer, Sci::Position appendLength); + + virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; + bool ValidMargin(uptr_t wParam) const; +diff -r 1788f6795302 -r a0f26eaf474d src/MarginView.cxx +--- a/src/MarginView.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/MarginView.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -183,7 +183,7 @@ + return markerCheck; + } + +-void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRectangle rcMargin, ++void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcMargin, + const EditModel &model, const ViewStyle &vs) { + + PRectangle rcSelMargin = rcMargin; +@@ -230,8 +230,8 @@ + } + + const int lineStartPaint = static_cast<int>(rcMargin.top + ptOrigin.y) / vs.lineHeight; +- int visibleLine = model.TopLineOfMain() + lineStartPaint; +- int yposScreen = lineStartPaint * vs.lineHeight - static_cast<int>(ptOrigin.y); ++ Sci::Line visibleLine = model.TopLineOfMain() + lineStartPaint; ++ Sci::Position yposScreen = lineStartPaint * vs.lineHeight - static_cast<Sci::Position>(ptOrigin.y); + // Work out whether the top line is whitespace located after a + // lessening of fold level which implies a 'fold tail' but which should not + // be displayed until the last of a sequence of whitespace. +@@ -239,7 +239,7 @@ + if (vs.ms[margin].mask & SC_MASK_FOLDERS) { + int level = model.pdoc->GetLevel(model.cs.DocFromDisplay(visibleLine)); + if (level & SC_FOLDLEVELWHITEFLAG) { +- int lineBack = model.cs.DocFromDisplay(visibleLine); ++ Sci::Line lineBack = model.cs.DocFromDisplay(visibleLine); + int levelPrev = level; + while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) { + lineBack--; +@@ -251,7 +251,7 @@ + } + } + if (highlightDelimiter.isEnabled) { +- int lastLine = model.cs.DocFromDisplay(topLine + model.LinesOnScreen()) + 1; ++ Sci::Line lastLine = model.cs.DocFromDisplay(topLine + model.LinesOnScreen()) + 1; + model.pdoc->GetHighlightDelimiters(highlightDelimiter, model.pdoc->LineFromPosition(model.sel.MainCaret()), lastLine); + } + } +@@ -265,10 +265,10 @@ + while ((visibleLine < model.cs.LinesDisplayed()) && yposScreen < rc.bottom) { + + PLATFORM_ASSERT(visibleLine < model.cs.LinesDisplayed()); +- const int lineDoc = model.cs.DocFromDisplay(visibleLine); ++ const Sci::Line lineDoc = model.cs.DocFromDisplay(visibleLine); + PLATFORM_ASSERT(model.cs.GetVisible(lineDoc)); +- const int firstVisibleLine = model.cs.DisplayFromDoc(lineDoc); +- const int lastVisibleLine = model.cs.DisplayLastFromDoc(lineDoc); ++ const Sci::Line firstVisibleLine = model.cs.DisplayFromDoc(lineDoc); ++ const Sci::Line lastVisibleLine = model.cs.DisplayLastFromDoc(lineDoc); + const bool firstSubLine = visibleLine == firstVisibleLine; + const bool lastSubLine = visibleLine == lastVisibleLine; + +@@ -313,7 +313,7 @@ + } + } + needWhiteClosure = false; +- const int firstFollowupLine = model.cs.DocFromDisplay(model.cs.DisplayFromDoc(lineDoc + 1)); ++ const Sci::Line firstFollowupLine = model.cs.DocFromDisplay(model.cs.DisplayFromDoc(lineDoc + 1)); + const int firstFollowupLineLevel = model.pdoc->GetLevel(firstFollowupLine); + const int secondFollowupLineLevelNum = LevelNumber(model.pdoc->GetLevel(firstFollowupLine + 1)); + if (!model.cs.GetExpanded(lineDoc)) { +diff -r 1788f6795302 -r a0f26eaf474d src/MarginView.h +--- a/src/MarginView.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/MarginView.h Fri Mar 31 18:19:38 2017 +1100 +@@ -39,7 +39,7 @@ + void DropGraphics(bool freeObjects); + void AllocateGraphics(const ViewStyle &vsDraw); + void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw); +- void PaintMargin(Surface *surface, int topLine, PRectangle rc, PRectangle rcMargin, ++ void PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcMargin, + const EditModel &model, const ViewStyle &vs); + }; + +diff -r 1788f6795302 -r a0f26eaf474d src/PerLine.cxx +--- a/src/PerLine.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/PerLine.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -131,13 +131,13 @@ + markers.DeleteAll(); + } + +-void LineMarkers::InsertLine(int line) { ++void LineMarkers::InsertLine(Sci::Line line) { + if (markers.Length()) { + markers.Insert(line, 0); + } + } + +-void LineMarkers::RemoveLine(int line) { ++void LineMarkers::RemoveLine(Sci::Line line) { + // Retain the markers from the deleted line by oring them into the previous line + if (markers.Length()) { + if (line > 0) { +@@ -147,9 +147,9 @@ + } + } + +-int LineMarkers::LineFromHandle(int markerHandle) { ++Sci::Line LineMarkers::LineFromHandle(int markerHandle) { + if (markers.Length()) { +- for (int line = 0; line < markers.Length(); line++) { ++ for (Sci::Line line = 0; line < markers.Length(); line++) { + if (markers[line]) { + if (markers[line]->Contains(markerHandle)) { + return line; +@@ -160,28 +160,28 @@ + return -1; + } + +-void LineMarkers::MergeMarkers(int pos) { +- if (markers[pos + 1] != NULL) { +- if (markers[pos] == NULL) +- markers[pos] = new MarkerHandleSet; +- markers[pos]->CombineWith(markers[pos + 1]); +- delete markers[pos + 1]; +- markers[pos + 1] = NULL; ++void LineMarkers::MergeMarkers(Sci::Line line) { ++ if (markers[line + 1] != NULL) { ++ if (markers[line] == NULL) ++ markers[line] = new MarkerHandleSet; ++ markers[line]->CombineWith(markers[line + 1]); ++ delete markers[line + 1]; ++ markers[line + 1] = NULL; + } + } + +-int LineMarkers::MarkValue(int line) { ++int LineMarkers::MarkValue(Sci::Line line) { + if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line]) + return markers[line]->MarkValue(); + else + return 0; + } + +-int LineMarkers::MarkerNext(int lineStart, int mask) const { ++Sci::Line LineMarkers::MarkerNext(Sci::Line lineStart, int mask) const { + if (lineStart < 0) + lineStart = 0; +- int length = markers.Length(); +- for (int iLine = lineStart; iLine < length; iLine++) { ++ Sci::Line length = markers.Length(); ++ for (Sci::Line iLine = lineStart; iLine < length; iLine++) { + MarkerHandleSet *onLine = markers[iLine]; + if (onLine && ((onLine->MarkValue() & mask) != 0)) + //if ((pdoc->GetMark(iLine) & lParam) != 0) +@@ -190,7 +190,7 @@ + return -1; + } + +-int LineMarkers::AddMark(int line, int markerNum, int lines) { ++int LineMarkers::AddMark(Sci::Line line, int markerNum, Sci::Line lines) { + handleCurrent++; + if (!markers.Length()) { + // No existing markers so allocate one element per line +@@ -208,7 +208,7 @@ + return handleCurrent; + } + +-bool LineMarkers::DeleteMark(int line, int markerNum, bool all) { ++bool LineMarkers::DeleteMark(Sci::Line line, int markerNum, bool all) { + bool someChanges = false; + if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line]) { + if (markerNum == -1) { +@@ -227,7 +227,7 @@ + } + + void LineMarkers::DeleteMarkFromHandle(int markerHandle) { +- int line = LineFromHandle(markerHandle); ++ Sci::Line line = LineFromHandle(markerHandle); + if (line >= 0) { + markers[line]->RemoveHandle(markerHandle); + if (markers[line]->Length() == 0) { +@@ -244,14 +244,14 @@ + levels.DeleteAll(); + } + +-void LineLevels::InsertLine(int line) { ++void LineLevels::InsertLine(Sci::Line line) { + if (levels.Length()) { + int level = (line < levels.Length()) ? levels[line] : SC_FOLDLEVELBASE; + levels.InsertValue(line, 1, level); + } + } + +-void LineLevels::RemoveLine(int line) { ++void LineLevels::RemoveLine(Sci::Line line) { + if (levels.Length()) { + // Move up following lines but merge header flag from this line + // to line before to avoid a temporary disappearence causing expansion. +@@ -264,7 +264,7 @@ + } + } + +-void LineLevels::ExpandLevels(int sizeNew) { ++void LineLevels::ExpandLevels(Sci::Line sizeNew) { + levels.InsertValue(levels.Length(), sizeNew - levels.Length(), SC_FOLDLEVELBASE); + } + +@@ -272,7 +272,7 @@ + levels.DeleteAll(); + } + +-int LineLevels::SetLevel(int line, int level, int lines) { ++int LineLevels::SetLevel(Sci::Line line, int level, Sci::Line lines) { + int prev = 0; + if ((line >= 0) && (line < lines)) { + if (!levels.Length()) { +@@ -286,7 +286,7 @@ + return prev; + } + +-int LineLevels::GetLevel(int line) const { ++int LineLevels::GetLevel(Sci::Line line) const { + if (levels.Length() && (line >= 0) && (line < levels.Length())) { + return levels[line]; + } else { +@@ -301,7 +301,7 @@ + lineStates.DeleteAll(); + } + +-void LineState::InsertLine(int line) { ++void LineState::InsertLine(Sci::Line line) { + if (lineStates.Length()) { + lineStates.EnsureLength(line); + int val = (line < lineStates.Length()) ? lineStates[line] : 0; +@@ -309,27 +309,27 @@ + } + } + +-void LineState::RemoveLine(int line) { ++void LineState::RemoveLine(Sci::Line line) { + if (lineStates.Length() > line) { + lineStates.Delete(line); + } + } + +-int LineState::SetLineState(int line, int state) { ++int LineState::SetLineState(Sci::Line line, int state) { + lineStates.EnsureLength(line + 1); + int stateOld = lineStates[line]; + lineStates[line] = state; + return stateOld; + } + +-int LineState::GetLineState(int line) { ++int LineState::GetLineState(Sci::Line line) { + if (line < 0) + return 0; + lineStates.EnsureLength(line + 1); + return lineStates[line]; + } + +-int LineState::GetMaxLineState() const { ++Sci::Line LineState::GetMaxLineState() const { + return lineStates.Length(); + } + +@@ -366,42 +366,42 @@ + ClearAll(); + } + +-void LineAnnotation::InsertLine(int line) { ++void LineAnnotation::InsertLine(Sci::Line line) { + if (annotations.Length()) { + annotations.EnsureLength(line); + annotations.Insert(line, 0); + } + } + +-void LineAnnotation::RemoveLine(int line) { ++void LineAnnotation::RemoveLine(Sci::Line line) { + if (annotations.Length() && (line > 0) && (line <= annotations.Length())) { + delete []annotations[line-1]; + annotations.Delete(line-1); + } + } + +-bool LineAnnotation::MultipleStyles(int line) const { ++bool LineAnnotation::MultipleStyles(Sci::Line line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return reinterpret_cast<AnnotationHeader *>(annotations[line])->style == IndividualStyles; + else + return 0; + } + +-int LineAnnotation::Style(int line) const { ++int LineAnnotation::Style(Sci::Line line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return reinterpret_cast<AnnotationHeader *>(annotations[line])->style; + else + return 0; + } + +-const char *LineAnnotation::Text(int line) const { ++const char *LineAnnotation::Text(Sci::Line line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return annotations[line]+sizeof(AnnotationHeader); + else + return 0; + } + +-const unsigned char *LineAnnotation::Styles(int line) const { ++const unsigned char *LineAnnotation::Styles(Sci::Line line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line] && MultipleStyles(line)) + return reinterpret_cast<unsigned char *>(annotations[line] + sizeof(AnnotationHeader) + Length(line)); + else +@@ -414,7 +414,7 @@ + return ret; + } + +-void LineAnnotation::SetText(int line, const char *text) { ++void LineAnnotation::SetText(Sci::Line line, const char *text) { + if (text && (line >= 0)) { + annotations.EnsureLength(line+1); + int style = Style(line); +@@ -443,7 +443,7 @@ + annotations.DeleteAll(); + } + +-void LineAnnotation::SetStyle(int line, int style) { ++void LineAnnotation::SetStyle(Sci::Line line, int style) { + annotations.EnsureLength(line+1); + if (!annotations[line]) { + annotations[line] = AllocateAnnotation(0, style); +@@ -451,7 +451,7 @@ + reinterpret_cast<AnnotationHeader *>(annotations[line])->style = static_cast<short>(style); + } + +-void LineAnnotation::SetStyles(int line, const unsigned char *styles) { ++void LineAnnotation::SetStyles(Sci::Line line, const unsigned char *styles) { + if (line >= 0) { + annotations.EnsureLength(line+1); + if (!annotations[line]) { +@@ -474,14 +474,14 @@ + } + } + +-int LineAnnotation::Length(int line) const { ++int LineAnnotation::Length(Sci::Line line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return reinterpret_cast<AnnotationHeader *>(annotations[line])->length; + else + return 0; + } + +-int LineAnnotation::Lines(int line) const { ++int LineAnnotation::Lines(Sci::Line line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return reinterpret_cast<AnnotationHeader *>(annotations[line])->lines; + else +@@ -499,21 +499,21 @@ + tabstops.DeleteAll(); + } + +-void LineTabstops::InsertLine(int line) { ++void LineTabstops::InsertLine(Sci::Line line) { + if (tabstops.Length()) { + tabstops.EnsureLength(line); + tabstops.Insert(line, 0); + } + } + +-void LineTabstops::RemoveLine(int line) { ++void LineTabstops::RemoveLine(Sci::Line line) { + if (tabstops.Length() > line) { + delete tabstops[line]; + tabstops.Delete(line); + } + } + +-bool LineTabstops::ClearTabstops(int line) { ++bool LineTabstops::ClearTabstops(Sci::Line line) { + if (line < tabstops.Length()) { + TabstopList *tl = tabstops[line]; + if (tl) { +@@ -524,7 +524,7 @@ + return false; + } + +-bool LineTabstops::AddTabstop(int line, int x) { ++bool LineTabstops::AddTabstop(Sci::Line line, int x) { + tabstops.EnsureLength(line + 1); + if (!tabstops[line]) { + tabstops[line] = new TabstopList(); +@@ -543,7 +543,7 @@ + return false; + } + +-int LineTabstops::GetNextTabstop(int line, int x) const { ++int LineTabstops::GetNextTabstop(Sci::Line line, int x) const { + if (line < tabstops.Length()) { + TabstopList *tl = tabstops[line]; + if (tl) { +diff -r 1788f6795302 -r a0f26eaf474d src/PerLine.h +--- a/src/PerLine.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/PerLine.h Fri Mar 31 18:19:38 2017 +1100 +@@ -49,16 +49,16 @@ + } + virtual ~LineMarkers(); + virtual void Init(); +- virtual void InsertLine(int line); +- virtual void RemoveLine(int line); ++ virtual void InsertLine(Sci::Line line); ++ virtual void RemoveLine(Sci::Line line); + +- int MarkValue(int line); +- int MarkerNext(int lineStart, int mask) const; +- int AddMark(int line, int marker, int lines); +- void MergeMarkers(int pos); +- bool DeleteMark(int line, int markerNum, bool all); ++ int MarkValue(Sci::Line line); ++ Sci::Line MarkerNext(Sci::Line lineStart, int mask) const; ++ int AddMark(Sci::Line line, int marker, Sci::Line lines); ++ void MergeMarkers(Sci::Line line); ++ bool DeleteMark(Sci::Line line, int markerNum, bool all); + void DeleteMarkFromHandle(int markerHandle); +- int LineFromHandle(int markerHandle); ++ Sci::Line LineFromHandle(int markerHandle); + }; + + class LineLevels : public PerLine { +@@ -66,13 +66,13 @@ + public: + virtual ~LineLevels(); + virtual void Init(); +- virtual void InsertLine(int line); +- virtual void RemoveLine(int line); ++ virtual void InsertLine(Sci::Line line); ++ virtual void RemoveLine(Sci::Line line); + +- void ExpandLevels(int sizeNew=-1); ++ void ExpandLevels(Sci::Line sizeNew=-1); + void ClearLevels(); +- int SetLevel(int line, int level, int lines); +- int GetLevel(int line) const; ++ int SetLevel(Sci::Line line, int level, Sci::Line lines); ++ int GetLevel(Sci::Line line) const; + }; + + class LineState : public PerLine { +@@ -82,12 +82,12 @@ + } + virtual ~LineState(); + virtual void Init(); +- virtual void InsertLine(int line); +- virtual void RemoveLine(int line); ++ virtual void InsertLine(Sci::Line line); ++ virtual void RemoveLine(Sci::Line line); + +- int SetLineState(int line, int state); +- int GetLineState(int line); +- int GetMaxLineState() const; ++ int SetLineState(Sci::Line line, int state); ++ int GetLineState(Sci::Line line); ++ Sci::Line GetMaxLineState() const; + }; + + class LineAnnotation : public PerLine { +@@ -97,19 +97,19 @@ + } + virtual ~LineAnnotation(); + virtual void Init(); +- virtual void InsertLine(int line); +- virtual void RemoveLine(int line); ++ virtual void InsertLine(Sci::Line line); ++ virtual void RemoveLine(Sci::Line line); + +- bool MultipleStyles(int line) const; +- int Style(int line) const; +- const char *Text(int line) const; +- const unsigned char *Styles(int line) const; +- void SetText(int line, const char *text); ++ bool MultipleStyles(Sci::Line line) const; ++ int Style(Sci::Line line) const; ++ const char *Text(Sci::Line line) const; ++ const unsigned char *Styles(Sci::Line line) const; ++ void SetText(Sci::Line line, const char *text); + void ClearAll(); +- void SetStyle(int line, int style); +- void SetStyles(int line, const unsigned char *styles); +- int Length(int line) const; +- int Lines(int line) const; ++ void SetStyle(Sci::Line line, int style); ++ void SetStyles(Sci::Line line, const unsigned char *styles); ++ int Length(Sci::Line line) const; ++ int Lines(Sci::Line line) const; + }; + + typedef std::vector<int> TabstopList; +@@ -121,12 +121,12 @@ + } + virtual ~LineTabstops(); + virtual void Init(); +- virtual void InsertLine(int line); +- virtual void RemoveLine(int line); ++ virtual void InsertLine(Sci::Line line); ++ virtual void RemoveLine(Sci::Line line); + +- bool ClearTabstops(int line); +- bool AddTabstop(int line, int x); +- int GetNextTabstop(int line, int x) const; ++ bool ClearTabstops(Sci::Line line); ++ bool AddTabstop(Sci::Line line, int x); ++ int GetNextTabstop(Sci::Line line, int x) const; + }; + + #ifdef SCI_NAMESPACE +diff -r 1788f6795302 -r a0f26eaf474d src/Position.h +--- a/src/Position.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/Position.h Fri Mar 31 18:19:38 2017 +1100 +@@ -16,6 +16,7 @@ + namespace Sci { + + typedef int Position; ++typedef int Line; + + // A later version (4.x) of this file may: + //#if defined(SCI_LARGE_FILE_SUPPORT) +diff -r 1788f6795302 -r a0f26eaf474d src/PositionCache.cxx +--- a/src/PositionCache.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/PositionCache.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -149,7 +149,7 @@ + lineStarts[line] = start; + } + +-void LineLayout::SetBracesHighlight(Range rangeLine, const Position braces[], ++void LineLayout::SetBracesHighlight(Range rangeLine, const Sci::Position braces[], + char bracesMatchStyle, int xHighlight, bool ignoreStyle) { + if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { + int braceOffset = braces[0] - rangeLine.start; +@@ -171,7 +171,7 @@ + } + } + +-void LineLayout::RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle) { ++void LineLayout::RestoreBracesHighlight(Range rangeLine, const Sci::Position braces[], bool ignoreStyle) { + if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { + int braceOffset = braces[0] - rangeLine.start; + if (braceOffset < numCharsInLine) { +@@ -267,7 +267,7 @@ + cache.resize(length_); + } + +-void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) { ++void LineLayoutCache::AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesInDoc) { + PLATFORM_ASSERT(useCount == 0); + size_t lengthForLevel = 0; + if (level == llcCaret) { +@@ -320,15 +320,15 @@ + } + } + +-LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, +- int linesOnScreen, int linesInDoc) { ++LineLayout *LineLayoutCache::Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, int maxChars, int styleClock_, ++ Sci::Line linesOnScreen, Sci::Line linesInDoc) { + AllocateForLevel(linesOnScreen, linesInDoc); + if (styleClock != styleClock_) { + Invalidate(LineLayout::llCheckTextAndStyle); + styleClock = styleClock_; + } + allInvalidated = false; +- int pos = -1; ++ Sci::Position pos = -1; + LineLayout *ret = 0; + if (level == llcCaret) { + pos = 0; +@@ -447,7 +447,7 @@ + } + } + +-BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, int posLineStart_, ++BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, Sci::Position posLineStart_, + int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw) : + ll(ll_), + lineRange(lineRange_), +@@ -486,7 +486,7 @@ + if (pvsDraw && pvsDraw->indicatorsSetFore > 0) { + for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { + if (pvsDraw->indicators[deco->indicator].OverridesTextFore()) { +- int startPos = deco->rs.EndRun(posLineStart); ++ Sci::Position startPos = deco->rs.EndRun(posLineStart); + while (startPos < (posLineStart + lineRange.end)) { + Insert(startPos - posLineStart); + startPos = deco->rs.EndRun(startPos); +diff -r 1788f6795302 -r a0f26eaf474d src/PositionCache.h +--- a/src/PositionCache.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/PositionCache.h Fri Mar 31 18:19:38 2017 +1100 +@@ -50,7 +50,7 @@ + int *lineStarts; + int lenLineStarts; + /// Drawing is only performed for @a maxLineLength characters on each line. +- int lineNumber; ++ Sci::Line lineNumber; + bool inCache; + public: + enum { wrapWidthInfinite = 0x7ffffff }; +@@ -86,9 +86,9 @@ + Range SubLineRange(int line) const; + bool InLine(int offset, int line) const; + void SetLineStart(int line, int start); +- void SetBracesHighlight(Range rangeLine, const Position braces[], ++ void SetBracesHighlight(Range rangeLine, const Sci::Position braces[], + char bracesMatchStyle, int xHighlight, bool ignoreStyle); +- void RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle); ++ void RestoreBracesHighlight(Range rangeLine, const Sci::Position braces[], bool ignoreStyle); + int FindBefore(XYPOSITION x, int lower, int upper) const; + int FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const; + Point PointFromPosition(int posInLine, int lineHeight, PointEnd pe) const; +@@ -104,7 +104,7 @@ + int styleClock; + int useCount; + void Allocate(size_t length_); +- void AllocateForLevel(int linesOnScreen, int linesInDoc); ++ void AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesInDoc); + public: + LineLayoutCache(); + virtual ~LineLayoutCache(); +@@ -118,8 +118,8 @@ + void Invalidate(LineLayout::validLevel validity_); + void SetLevel(int level_); + int GetLevel() const { return level; } +- LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, +- int linesOnScreen, int linesInDoc); ++ LineLayout *Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, int maxChars, int styleClock_, ++ Sci::Line linesOnScreen, Sci::Line linesInDoc); + void Dispose(LineLayout *ll); + }; + +@@ -176,7 +176,7 @@ + class BreakFinder { + const LineLayout *ll; + Range lineRange; +- int posLineStart; ++ Sci::Position posLineStart; + int nextBreak; + std::vector<int> selAndEdge; + unsigned int saeCurrentPos; +@@ -194,7 +194,7 @@ + enum { lengthStartSubdivision = 300 }; + // Try to make each subdivided run lengthEachSubdivision or shorter. + enum { lengthEachSubdivision = 100 }; +- BreakFinder(const LineLayout *ll_, const Selection *psel, Range rangeLine_, int posLineStart_, ++ BreakFinder(const LineLayout *ll_, const Selection *psel, Range rangeLine_, Sci::Position posLineStart_, + int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); + ~BreakFinder(); + TextSegment Next(); +diff -r 1788f6795302 -r a0f26eaf474d src/RESearch.cxx +--- a/src/RESearch.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/RESearch.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -277,9 +277,9 @@ + void RESearch::GrabMatches(CharacterIndexer &ci) { + for (unsigned int i = 0; i < MAXTAG; i++) { + if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) { +- unsigned int len = eopat[i] - bopat[i]; ++ Sci::Position len = eopat[i] - bopat[i]; + pat[i].resize(len); +- for (unsigned int j = 0; j < len; j++) ++ for (Sci::Position j = 0; j < len; j++) + pat[i][j] = ci.CharAt(bopat[i] + j); + } + } +@@ -434,7 +434,7 @@ + return result; + } + +-const char *RESearch::Compile(const char *pattern, int length, bool caseSensitive, bool posix) { ++const char *RESearch::Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) { + char *mp=nfa; /* nfa pointer */ + char *lp; /* saved pointer */ + char *sp=nfa; /* another one */ +@@ -755,9 +755,9 @@ + * respectively. + * + */ +-int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) { ++int RESearch::Execute(CharacterIndexer &ci, Sci::Position lp, Sci::Position endp) { + unsigned char c; +- int ep = NOTFOUND; ++ Sci::Position ep = NOTFOUND; + char *ap = nfa; + + bol = lp; +@@ -844,13 +844,13 @@ + #define CHRSKIP 3 /* [CLO] CHR chr END */ + #define CCLSKIP 34 /* [CLO] CCL 32 bytes END */ + +-int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) { ++Sci::Position RESearch::PMatch(CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap) { + int op, c, n; +- int e; /* extra pointer for CLO */ +- int bp; /* beginning of subpat... */ +- int ep; /* ending of subpat... */ +- int are; /* to save the line ptr. */ +- int llp; /* lazy lp for LCLO */ ++ Sci::Position e; /* extra pointer for CLO */ ++ Sci::Position bp; /* beginning of subpat... */ ++ Sci::Position ep; /* ending of subpat... */ ++ Sci::Position are; /* to save the line ptr. */ ++ Sci::Position llp; /* lazy lp for LCLO */ + + while ((op = *ap++) != END) + switch (op) { +@@ -940,7 +940,7 @@ + llp = lp; + e = NOTFOUND; + while (llp >= are) { +- int q; ++ Sci::Position q; + if ((q = PMatch(ci, llp, endp, ap)) != NOTFOUND) { + e = q; + lp = llp; +diff -r 1788f6795302 -r a0f26eaf474d src/RESearch.h +--- a/src/RESearch.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/RESearch.h Fri Mar 31 18:19:38 2017 +1100 +@@ -23,7 +23,7 @@ + + class CharacterIndexer { + public: +- virtual char CharAt(int index)=0; ++ virtual char CharAt(Sci::Position index)=0; + virtual ~CharacterIndexer() { + } + }; +@@ -35,15 +35,15 @@ + ~RESearch(); + void Clear(); + void GrabMatches(CharacterIndexer &ci); +- const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix); +- int Execute(CharacterIndexer &ci, int lp, int endp); ++ const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix); ++ int Execute(CharacterIndexer &ci, Sci::Position lp, Sci::Position endp); + + enum { MAXTAG=10 }; + enum { MAXNFA=4096 }; + enum { NOTFOUND=-1 }; + +- int bopat[MAXTAG]; +- int eopat[MAXTAG]; ++ Sci::Position bopat[MAXTAG]; ++ Sci::Position eopat[MAXTAG]; + std::string pat[MAXTAG]; + + private: +@@ -51,10 +51,10 @@ + void ChSetWithCase(unsigned char c, bool caseSensitive); + int GetBackslashExpression(const char *pattern, int &incr); + +- int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap); ++ Sci::Position PMatch(CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap); + +- int bol; +- int tagstk[MAXTAG]; /* subpat tag stack */ ++ Sci::Position bol; ++ Sci::Position tagstk[MAXTAG]; /* subpat tag stack */ + char nfa[MAXNFA]; /* automaton */ + int sta; + unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */ +diff -r 1788f6795302 -r a0f26eaf474d src/ScintillaBase.cxx +--- a/src/ScintillaBase.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/ScintillaBase.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -207,24 +207,24 @@ + sci->AutoCompleteCompleted(0, SC_AC_DOUBLECLICK); + } + +-void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) { ++void ScintillaBase::AutoCompleteInsert(Sci::Position startPos, int removeLen, const char *text, int textLen) { + UndoGroup ug(pdoc); + if (multiAutoCMode == SC_MULTIAUTOC_ONCE) { + pdoc->DeleteChars(startPos, removeLen); +- const int lengthInserted = pdoc->InsertString(startPos, text, textLen); ++ const Sci::Position lengthInserted = pdoc->InsertString(startPos, text, textLen); + SetEmptySelection(startPos + lengthInserted); + } else { + // SC_MULTIAUTOC_EACH + for (size_t r=0; r<sel.Count(); r++) { + if (!RangeContainsProtected(sel.Range(r).Start().Position(), + sel.Range(r).End().Position())) { +- int positionInsert = sel.Range(r).Start().Position(); ++ Sci::Position positionInsert = sel.Range(r).Start().Position(); + positionInsert = RealizeVirtualSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); + if (positionInsert - removeLen >= 0) { + positionInsert -= removeLen; + pdoc->DeleteChars(positionInsert, removeLen); + } +- const int lengthInserted = pdoc->InsertString(positionInsert, text, textLen); ++ const Sci::Position lengthInserted = pdoc->InsertString(positionInsert, text, textLen); + if (lengthInserted > 0) { + sel.Range(r).caret.SetPosition(positionInsert + lengthInserted); + sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted); +@@ -382,7 +382,7 @@ + scn.listCompletionMethod = completionMethod; + scn.wParam = listType; + scn.listType = listType; +- Position firstPos = ac.posStart - ac.startLen; ++ Sci::Position firstPos = ac.posStart - ac.startLen; + scn.position = firstPos; + scn.lParam = firstPos; + scn.text = selected.c_str(); +@@ -395,7 +395,7 @@ + if (listType > 0) + return; + +- Position endPos = sel.MainCaret(); ++ Sci::Position endPos = sel.MainCaret(); + if (ac.dropRestOfWord) + endPos = pdoc->ExtendWordSelect(endPos, 1, true); + if (endPos < firstPos) +@@ -771,11 +771,11 @@ + + #endif + +-void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { ++void ScintillaBase::NotifyStyleToNeeded(Sci::Position endStyleNeeded) { + #ifdef SCI_LEXER + if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) { +- int lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled()); +- int endStyled = pdoc->LineStart(lineEndStyled); ++ Sci::Line lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled()); ++ Sci::Position endStyled = pdoc->LineStart(lineEndStyled); + DocumentLexState()->Colourise(endStyled, endStyleNeeded); + return; + } +@@ -994,10 +994,10 @@ + + case SCI_COLOURISE: + if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) { +- pdoc->ModifiedAt(static_cast<int>(wParam)); +- NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : static_cast<int>(lParam)); ++ pdoc->ModifiedAt(static_cast<Sci::Position>(wParam)); ++ NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : static_cast<Sci::Position>(lParam)); + } else { +- DocumentLexState()->Colourise(static_cast<int>(wParam), static_cast<int>(lParam)); ++ DocumentLexState()->Colourise(static_cast<Sci::Position>(wParam), static_cast<Sci::Position>(lParam)); + } + Redraw(); + break; +diff -r 1788f6795302 -r a0f26eaf474d src/ScintillaBase.h +--- a/src/ScintillaBase.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/ScintillaBase.h Fri Mar 31 18:19:38 2017 +1100 +@@ -67,7 +67,7 @@ + virtual void CancelModes(); + virtual int KeyCommand(unsigned int iMessage); + +- void AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen); ++ void AutoCompleteInsert(Sci::Position startPos, int removeLen, const char *text, int textLen); + void AutoCompleteStart(int lenEntered, const char *list); + void AutoCompleteCancel(); + void AutoCompleteMove(int delta); +@@ -91,7 +91,7 @@ + virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); + virtual void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); + +- void NotifyStyleToNeeded(int endStyleNeeded); ++ void NotifyStyleToNeeded(Sci::Position endStyleNeeded); + void NotifyLexerChanged(Document *doc, void *userData); + + public: +diff -r 1788f6795302 -r a0f26eaf474d src/Selection.cxx +--- a/src/Selection.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/Selection.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -22,10 +22,10 @@ + using namespace Scintilla; + #endif + +-void SelectionPosition::MoveForInsertDelete(bool insertion, int startChange, int length) { ++void SelectionPosition::MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length) { + if (insertion) { + if (position == startChange) { +- int virtualLengthRemove = std::min(length, virtualSpace); ++ Sci::Position virtualLengthRemove = std::min(length, virtualSpace); + virtualSpace -= virtualLengthRemove; + position += virtualLengthRemove; + } else if (position > startChange) { +@@ -36,7 +36,7 @@ + virtualSpace = 0; + } + if (position > startChange) { +- int endDeletion = startChange + length; ++ Sci::Position endDeletion = startChange + length; + if (position > endDeletion) { + position -= length; + } else { +@@ -75,7 +75,7 @@ + return *this > other; + } + +-int SelectionRange::Length() const { ++Sci::Position SelectionRange::Length() const { + if (anchor > caret) { + return anchor.Position() - caret.Position(); + } else { +@@ -83,12 +83,12 @@ + } + } + +-void SelectionRange::MoveForInsertDelete(bool insertion, int startChange, int length) { ++void SelectionRange::MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length) { + caret.MoveForInsertDelete(insertion, startChange, length); + anchor.MoveForInsertDelete(insertion, startChange, length); + } + +-bool SelectionRange::Contains(int pos) const { ++bool SelectionRange::Contains(Sci::Position pos) const { + if (anchor > caret) + return (pos >= caret.Position()) && (pos <= anchor.Position()); + else +@@ -102,7 +102,7 @@ + return (sp >= anchor) && (sp <= caret); + } + +-bool SelectionRange::ContainsCharacter(int posCharacter) const { ++bool SelectionRange::ContainsCharacter(Sci::Position posCharacter) const { + if (anchor > caret) + return (posCharacter >= caret.Position()) && (posCharacter < anchor.Position()); + else +@@ -168,7 +168,7 @@ + // If range is all virtual collapse to start of virtual space + void SelectionRange::MinimizeVirtualSpace() { + if (caret.Position() == anchor.Position()) { +- int virtualSpace = caret.VirtualSpace(); ++ Sci::Position virtualSpace = caret.VirtualSpace(); + if (virtualSpace > anchor.VirtualSpace()) + virtualSpace = anchor.VirtualSpace(); + caret.SetVirtualSpace(virtualSpace); +@@ -187,11 +187,11 @@ + return (selType == selRectangle) || (selType == selThin); + } + +-int Selection::MainCaret() const { ++Sci::Position Selection::MainCaret() const { + return ranges[mainRange].caret.Position(); + } + +-int Selection::MainAnchor() const { ++Sci::Position Selection::MainAnchor() const { + return ranges[mainRange].anchor.Position(); + } + +@@ -284,15 +284,15 @@ + return lastPosition; + } + +-int Selection::Length() const { +- int len = 0; ++Sci::Position Selection::Length() const { ++ Sci::Position len = 0; + for (size_t i=0; i<ranges.size(); i++) { + len += ranges[i].Length(); + } + return len; + } + +-void Selection::MovePositions(bool insertion, int startChange, int length) { ++void Selection::MovePositions(bool insertion, Sci::Position startChange, Sci::Position length) { + for (size_t i=0; i<ranges.size(); i++) { + ranges[i].MoveForInsertDelete(insertion, startChange, length); + } +@@ -376,7 +376,7 @@ + tentativeMain = false; + } + +-int Selection::CharacterInSelection(int posCharacter) const { ++int Selection::CharacterInSelection(Sci::Position posCharacter) const { + for (size_t i=0; i<ranges.size(); i++) { + if (ranges[i].ContainsCharacter(posCharacter)) + return i == mainRange ? 1 : 2; +@@ -384,7 +384,7 @@ + return 0; + } + +-int Selection::InSelectionForEOL(int pos) const { ++int Selection::InSelectionForEOL(Sci::Position pos) const { + for (size_t i=0; i<ranges.size(); i++) { + if (!ranges[i].Empty() && (pos > ranges[i].Start().Position()) && (pos <= ranges[i].End().Position())) + return i == mainRange ? 1 : 2; +@@ -392,8 +392,8 @@ + return 0; + } + +-int Selection::VirtualSpaceFor(int pos) const { +- int virtualSpace = 0; ++Sci::Position Selection::VirtualSpaceFor(Sci::Position pos) const { ++ Sci::Position virtualSpace = 0; + for (size_t i=0; i<ranges.size(); i++) { + if ((ranges[i].caret.Position() == pos) && (virtualSpace < ranges[i].caret.VirtualSpace())) + virtualSpace = ranges[i].caret.VirtualSpace(); +diff -r 1788f6795302 -r a0f26eaf474d src/Selection.h +--- a/src/Selection.h Thu Mar 30 09:11:48 2017 +1100 ++++ b/src/Selection.h Fri Mar 31 18:19:38 2017 +1100 +@@ -13,10 +13,10 @@ + #endif + + class SelectionPosition { +- int position; +- int virtualSpace; ++ Sci::Position position; ++ Sci::Position virtualSpace; + public: +- explicit SelectionPosition(int position_=INVALID_POSITION, int virtualSpace_=0) : position(position_), virtualSpace(virtualSpace_) { ++ explicit SelectionPosition(Sci::Position position_=INVALID_POSITION, Sci::Position virtualSpace_=0) : position(position_), virtualSpace(virtualSpace_) { + PLATFORM_ASSERT(virtualSpace < 800000); + if (virtualSpace < 0) + virtualSpace = 0; +@@ -25,7 +25,7 @@ + position = 0; + virtualSpace = 0; + } +- void MoveForInsertDelete(bool insertion, int startChange, int length); ++ void MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length); + bool operator ==(const SelectionPosition &other) const { + return position == other.position && virtualSpace == other.virtualSpace; + } +@@ -33,22 +33,22 @@ + bool operator >(const SelectionPosition &other) const; + bool operator <=(const SelectionPosition &other) const; + bool operator >=(const SelectionPosition &other) const; +- int Position() const { ++ Sci::Position Position() const { + return position; + } +- void SetPosition(int position_) { ++ void SetPosition(Sci::Position position_) { + position = position_; + virtualSpace = 0; + } +- int VirtualSpace() const { ++ Sci::Position VirtualSpace() const { + return virtualSpace; + } +- void SetVirtualSpace(int virtualSpace_) { ++ void SetVirtualSpace(Sci::Position virtualSpace_) { + PLATFORM_ASSERT(virtualSpace_ < 800000); + if (virtualSpace_ >= 0) + virtualSpace = virtualSpace_; + } +- void Add(int increment) { ++ void Add(Sci::Position increment) { + position = position + increment; + } + bool IsValid() const { +@@ -90,17 +90,17 @@ + } + explicit SelectionRange(SelectionPosition single) : caret(single), anchor(single) { + } +- explicit SelectionRange(int single) : caret(single), anchor(single) { ++ explicit SelectionRange(Sci::Position single) : caret(single), anchor(single) { + } + SelectionRange(SelectionPosition caret_, SelectionPosition anchor_) : caret(caret_), anchor(anchor_) { + } +- SelectionRange(int caret_, int anchor_) : caret(caret_), anchor(anchor_) { ++ SelectionRange(Sci::Position caret_, Sci::Position anchor_) : caret(caret_), anchor(anchor_) { + } + bool Empty() const { + return anchor == caret; + } +- int Length() const; +- // int Width() const; // Like Length but takes virtual space into account ++ Sci::Position Length() const; ++ // Sci::Position Width() const; // Like Length but takes virtual space into account + bool operator ==(const SelectionRange &other) const { + return caret == other.caret && anchor == other.anchor; + } +@@ -115,10 +115,10 @@ + anchor.SetVirtualSpace(0); + caret.SetVirtualSpace(0); + } +- void MoveForInsertDelete(bool insertion, int startChange, int length); +- bool Contains(int pos) const; ++ void MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length); ++ bool Contains(Sci::Position pos) const; + bool Contains(SelectionPosition sp) const; +- bool ContainsCharacter(int posCharacter) const; ++ bool ContainsCharacter(Sci::Position posCharacter) const; + SelectionSegment Intersect(SelectionSegment check) const; + SelectionPosition Start() const { + return (anchor < caret) ? anchor : caret; +@@ -146,8 +146,8 @@ + Selection(); + ~Selection(); + bool IsRectangular() const; +- int MainCaret() const; +- int MainAnchor() const; ++ Sci::Position MainCaret() const; ++ Sci::Position MainAnchor() const; + SelectionRange &Rectangular(); + SelectionSegment Limits() const; + // This is for when you want to move the caret in response to a +@@ -166,8 +166,8 @@ + void SetMoveExtends(bool moveExtends_); + bool Empty() const; + SelectionPosition Last() const; +- int Length() const; +- void MovePositions(bool insertion, int startChange, int length); ++ Sci::Position Length() const; ++ void MovePositions(bool insertion, Sci::Position startChange, Sci::Position length); + void TrimSelection(SelectionRange range); + void TrimOtherSelections(size_t r, SelectionRange range); + void SetSelection(SelectionRange range); +@@ -177,9 +177,9 @@ + void DropAdditionalRanges(); + void TentativeSelection(SelectionRange range); + void CommitTentative(); +- int CharacterInSelection(int posCharacter) const; +- int InSelectionForEOL(int pos) const; +- int VirtualSpaceFor(int pos) const; ++ int CharacterInSelection(Sci::Position posCharacter) const; ++ int InSelectionForEOL(Sci::Position pos) const; ++ Sci::Position VirtualSpaceFor(Sci::Position pos) const; + void Clear(); + void RemoveDuplicates(); + void RotateMain(); +diff -r 1788f6795302 -r a0f26eaf474d win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Thu Mar 30 09:11:48 2017 +1100 ++++ b/win32/ScintillaWin.cxx Fri Mar 31 18:19:38 2017 +1100 +@@ -294,15 +294,15 @@ + + bool DragThreshold(Point ptStart, Point ptNow) override; + void StartDrag() override; +- int TargetAsUTF8(char *text); ++ Sci::Position TargetAsUTF8(char *text); + void AddCharUTF16(wchar_t const *wcs, unsigned int wclen); +- int EncodedFromUTF8(char *utf8, char *encoded) const; ++ Sci::Position EncodedFromUTF8(char *utf8, char *encoded) const; + sptr_t WndPaint(uptr_t wParam); + + sptr_t HandleCompositionWindowed(uptr_t wParam, sptr_t lParam); + sptr_t HandleCompositionInline(uptr_t wParam, sptr_t lParam); + static bool KoreanIME(); +- void MoveImeCarets(int offset); ++ void MoveImeCarets(Sci::Position offset); + void DrawImeIndicator(int indicator, int len); + void SetCandidateWindowPos(); + void SelectionToHangul(); +@@ -323,12 +323,12 @@ + bool HaveMouseCapture() override; + void SetTrackMouseLeaveEvent(bool on); + bool PaintContains(PRectangle rc) override; +- void ScrollText(int linesToMove) override; ++ void ScrollText(Sci::Line linesToMove) override; + void NotifyCaretMove() override; + void UpdateSystemCaret() override; + void SetVerticalScrollPos() override; + void SetHorizontalScrollPos() override; +- bool ModifyScrollBars(int nMax, int nPage) override; ++ bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) override; + void NotifyChange() override; + void NotifyFocus(bool focus) override; + void SetCtrlID(int identifier) override; +@@ -361,7 +361,7 @@ + + int SetScrollInfo(int nBar, LPCSCROLLINFO lpsi, BOOL bRedraw); + bool GetScrollInfo(int nBar, LPSCROLLINFO lpsi); +- void ChangeScrollPos(int barType, int pos); ++ void ChangeScrollPos(int barType, Sci::Position pos); + sptr_t GetTextLength(); + sptr_t GetText(uptr_t wParam, sptr_t lParam); + +@@ -618,7 +618,7 @@ + } + } + inDragDrop = ddNone; +- SetDragPosition(SelectionPosition(invalidPosition)); ++ SetDragPosition(SelectionPosition(Sci::invalidPosition)); + } + + // Avoid warnings everywhere for old style casts by concentrating them here +@@ -730,8 +730,8 @@ + + // Returns the target converted to UTF8. + // Return the length in bytes. +-int ScintillaWin::TargetAsUTF8(char *text) { +- int targetLength = targetEnd - targetStart; ++Sci::Position ScintillaWin::TargetAsUTF8(char *text) { ++ Sci::Position targetLength = targetEnd - targetStart; + if (IsUnicodeMode()) { + if (text) { + pdoc->GetCharRange(text, targetStart, targetLength); +@@ -752,8 +752,8 @@ + + // Translates a nul terminated UTF8 string into the document encoding. + // Return the length of the result in bytes. +-int ScintillaWin::EncodedFromUTF8(char *utf8, char *encoded) const { +- int inputLength = (lengthForEncode >= 0) ? lengthForEncode : static_cast<int>(strlen(utf8)); ++Sci::Position ScintillaWin::EncodedFromUTF8(char *utf8, char *encoded) const { ++ Sci::Position inputLength = (lengthForEncode >= 0) ? lengthForEncode : static_cast<Sci::Position>(strlen(utf8)); + if (IsUnicodeMode()) { + if (encoded) { + memcpy(encoded, utf8, inputLength); +@@ -889,10 +889,10 @@ + return codePage == 949 || codePage == 1361; + } + +-void ScintillaWin::MoveImeCarets(int offset) { ++void ScintillaWin::MoveImeCarets(Sci::Position offset) { + // Move carets relatively by bytes. + for (size_t r=0; r<sel.Count(); r++) { +- int positionInsert = sel.Range(r).Start().Position(); ++ Sci::Position positionInsert = sel.Range(r).Start().Position(); + sel.Range(r).caret.SetPosition(positionInsert + offset); + sel.Range(r).anchor.SetPosition(positionInsert + offset); + } +@@ -908,7 +908,7 @@ + } + pdoc->decorations.SetCurrentIndicator(indicator); + for (size_t r=0; r<sel.Count(); r++) { +- int positionInsert = sel.Range(r).Start().Position(); ++ Sci::Position positionInsert = sel.Range(r).Start().Position(); + pdoc->DecorationFillRange(positionInsert - len, 1, len); + } + } +@@ -928,10 +928,10 @@ + + void ScintillaWin::SelectionToHangul() { + // Convert every hanja to hangul within the main range. +- const int selStart = sel.RangeMain().Start().Position(); +- const int documentStrLen = sel.RangeMain().Length(); +- const int selEnd = selStart + documentStrLen; +- const int utf16Len = pdoc->CountUTF16(selStart, selEnd); ++ const Sci::Position selStart = sel.RangeMain().Start().Position(); ++ const Sci::Position documentStrLen = sel.RangeMain().Length(); ++ const Sci::Position selEnd = selStart + documentStrLen; ++ const Sci::Position utf16Len = pdoc->CountUTF16(selStart, selEnd); + + if (utf16Len > 0) { + std::string documentStr(documentStrLen, '\0'); +@@ -957,7 +957,7 @@ + if (sel.Count() > 1) { + return; // Do not allow multi carets. + } +- int currentPos = CurrentPosition(); ++ Sci::Position currentPos = CurrentPosition(); + int oneCharLen = pdoc->LenChar(currentPos); + + if (oneCharLen < 2) { +@@ -1091,7 +1091,7 @@ + + // Move IME caret from current last position to imeCaretPos. + int imeEndToImeCaretU16 = imc.GetImeCaretPos() - static_cast<unsigned int>(wcs.size()); +- int imeCaretPosDoc = pdoc->GetRelativePositionUTF16(CurrentPosition(), imeEndToImeCaretU16); ++ Sci::Position imeCaretPosDoc = pdoc->GetRelativePositionUTF16(CurrentPosition(), imeEndToImeCaretU16); + + MoveImeCarets(- CurrentPosition() + imeCaretPosDoc); + +@@ -1298,7 +1298,7 @@ + // Either SCROLL or ZOOM. We handle the wheel steppings calculation + wheelDelta -= static_cast<short>(HiWord(wParam)); + if (abs(wheelDelta) >= WHEEL_DELTA && linesPerScroll > 0) { +- int linesToScroll = linesPerScroll; ++ Sci::Line linesToScroll = linesPerScroll; + if (linesPerScroll == WHEEL_PAGESCROLL) + linesToScroll = LinesOnScreen() - 1; + if (linesToScroll == 0) { +@@ -1663,8 +1663,8 @@ + break; + + case EM_SETSEL: { +- int nStart = static_cast<int>(wParam); +- int nEnd = static_cast<int>(lParam); ++ Sci::Position nStart = static_cast<Sci::Position>(wParam); ++ Sci::Position nEnd = static_cast<Sci::Position>(lParam); + if (nStart == 0 && nEnd == -1) { + nEnd = pdoc->Length(); + } +@@ -1850,7 +1850,7 @@ + return true; + } + +-void ScintillaWin::ScrollText(int /* linesToMove */) { ++void ScintillaWin::ScrollText(Sci::Line /* linesToMove */) { + //Platform::DebugPrintf("ScintillaWin::ScrollText %d\n", linesToMove); + //::ScrollWindow(MainHWND(), 0, + // vs.lineHeight * linesToMove, 0, 0); +@@ -1883,7 +1883,7 @@ + } + + // Change the scroll position but avoid repaint if changing to same value +-void ScintillaWin::ChangeScrollPos(int barType, int pos) { ++void ScintillaWin::ChangeScrollPos(int barType, Sci::Position pos) { + SCROLLINFO sci = { + sizeof(sci), 0, 0, 0, 0, 0, 0 + }; +@@ -1904,14 +1904,14 @@ + ChangeScrollPos(SB_HORZ, xOffset); + } + +-bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) { ++bool ScintillaWin::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) { + bool modified = false; + SCROLLINFO sci = { + sizeof(sci), 0, 0, 0, 0, 0, 0 + }; + sci.fMask = SIF_PAGE | SIF_RANGE; + GetScrollInfo(SB_VERT, &sci); +- int vertEndPreferred = nMax; ++ Sci::Line vertEndPreferred = nMax; + if (!verticalScrollBarVisible) + nPage = vertEndPreferred + 1; + if ((sci.nMin != 0) || +@@ -1932,14 +1932,14 @@ + int horizEndPreferred = scrollWidth; + if (horizEndPreferred < 0) + horizEndPreferred = 0; +- unsigned int pageWidth = static_cast<unsigned int>(rcText.Width()); ++ int pageWidth = static_cast<int>(rcText.Width()); + if (!horizontalScrollBarVisible || Wrapping()) + pageWidth = horizEndPreferred + 1; + sci.fMask = SIF_PAGE | SIF_RANGE; + GetScrollInfo(SB_HORZ, &sci); + if ((sci.nMin != 0) || + (sci.nMax != horizEndPreferred) || +- (sci.nPage != pageWidth) || ++ (sci.nPage != static_cast<unsigned int>(pageWidth)) || + (sci.nPos != 0)) { + sci.fMask = SIF_PAGE | SIF_RANGE; + sci.nMin = 0; +@@ -1949,7 +1949,7 @@ + sci.nTrackPos = 1; + SetScrollInfo(SB_HORZ, &sci, TRUE); + modified = true; +- if (scrollWidth < static_cast<int>(pageWidth)) { ++ if (scrollWidth < pageWidth) { + HorizontalScrollTo(0); + } + } +@@ -2673,13 +2673,13 @@ + LRESULT ScintillaWin::ImeOnReconvert(LPARAM lParam) { + // Reconversion on windows limits within one line without eol. + // Look around: baseStart <-- (|mainStart| -- mainEnd) --> baseEnd. +- const int mainStart = sel.RangeMain().Start().Position(); +- const int mainEnd = sel.RangeMain().End().Position(); +- const int curLine = pdoc->LineFromPosition(mainStart); ++ const Sci::Position mainStart = sel.RangeMain().Start().Position(); ++ const Sci::Position mainEnd = sel.RangeMain().End().Position(); ++ const Sci::Line curLine = pdoc->LineFromPosition(mainStart); + if (curLine != pdoc->LineFromPosition(mainEnd)) + return 0; +- const int baseStart = pdoc->LineStart(curLine); +- const int baseEnd = pdoc->LineEnd(curLine); ++ const Sci::Position baseStart = pdoc->LineStart(curLine); ++ const Sci::Position baseEnd = pdoc->LineEnd(curLine); + if ((baseStart == baseEnd) || (mainEnd > baseEnd)) + return 0; + +@@ -2730,8 +2730,8 @@ + + // Make place for next composition string to sit in. + for (size_t r=0; r<sel.Count(); r++) { +- int rBase = sel.Range(r).Start().Position(); +- int docCompStart = rBase + adjust; ++ Sci::Position rBase = sel.Range(r).Start().Position(); ++ Sci::Position docCompStart = rBase + adjust; + + if (inOverstrike) { // the docCompLen of bytes will be overstriked. + sel.Range(r).caret.SetPosition(docCompStart); +@@ -2739,8 +2739,8 @@ + } else { + // Ensure docCompStart+docCompLen be not beyond lineEnd. + // since docCompLen by byte might break eol. +- int lineEnd = pdoc->LineEnd(pdoc->LineFromPosition(rBase)); +- int overflow = (docCompStart + docCompLen) - lineEnd; ++ Sci::Position lineEnd = pdoc->LineEnd(pdoc->LineFromPosition(rBase)); ++ Sci::Position overflow = (docCompStart + docCompLen) - lineEnd; + if (overflow > 0) { + pdoc->DeleteChars(docCompStart, docCompLen - overflow); + } else { +@@ -2833,7 +2833,7 @@ + //Platform::DebugPrintf("ScrollInfo %d mask=%x min=%d max=%d page=%d pos=%d track=%d\n", b,sci.fMask, + //sci.nMin, sci.nMax, sci.nPage, sci.nPos, sci.nTrackPos); + +- int topLineNew = topLine; ++ Sci::Line topLineNew = topLine; + switch (LoWord(wParam)) { + case SB_LINEUP: + topLineNew -= 1; +@@ -3038,7 +3038,7 @@ + + STDMETHODIMP ScintillaWin::DragLeave() { + try { +- SetDragPosition(SelectionPosition(invalidPosition)); ++ SetDragPosition(SelectionPosition(Sci::invalidPosition)); + return S_OK; + } catch (...) { + errorStatus = SC_STATUS_FAILURE; +@@ -3054,7 +3054,7 @@ + if (pIDataSource == NULL) + return E_POINTER; + +- SetDragPosition(SelectionPosition(invalidPosition)); ++ SetDragPosition(SelectionPosition(Sci::invalidPosition)); + + STGMEDIUM medium = {0, {0}, 0}; + diff --git a/src/scintilla_backports/6154_284cc3b0e754.patch b/src/scintilla_backports/6154_284cc3b0e754.patch new file mode 100644 index 00000000..09267db3 --- /dev/null +++ b/src/scintilla_backports/6154_284cc3b0e754.patch @@ -0,0 +1,18 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1490950601 -39600 +# Node ID 284cc3b0e7544e9894323fd07e038fdec383b836 +# Parent a0f26eaf474d98cb999629f79a3d082c0028925b +Delete declaration of unimplemented method. + +diff -r a0f26eaf474d -r 284cc3b0e754 src/Document.h +--- a/src/Document.h Fri Mar 31 18:19:38 2017 +1100 ++++ b/src/Document.h Fri Mar 31 19:56:41 2017 +1100 +@@ -379,7 +379,6 @@ + Sci::Line GetFoldParent(Sci::Line line) const; + void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, Sci::Line line, Sci::Line lastLine); + +- void Indent(bool forwards); + Sci::Position ExtendWordSelect(Sci::Position pos, int delta, bool onlyWordCharacters=false) const; + Sci::Position NextWordStart(Sci::Position pos, int delta) const; + Sci::Position NextWordEnd(Sci::Position pos, int delta) const; diff --git a/src/scintilla_backports/6155_c105254dae66.patch b/src/scintilla_backports/6155_c105254dae66.patch new file mode 100644 index 00000000..8eddcd9b --- /dev/null +++ b/src/scintilla_backports/6155_c105254dae66.patch @@ -0,0 +1,95 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1490962049 -39600 +# Node ID c105254dae66064fe4898cc13f409c7abfc1edab +# Parent 284cc3b0e7544e9894323fd07e038fdec383b836 +Hide decorations details a little. + +diff -r 284cc3b0e754 -r c105254dae66 cocoa/ScintillaCocoa.mm +--- a/cocoa/ScintillaCocoa.mm Fri Mar 31 19:56:41 2017 +1100 ++++ b/cocoa/ScintillaCocoa.mm Fri Mar 31 23:07:29 2017 +1100 +@@ -2394,7 +2394,7 @@ + void ScintillaCocoa::CompositionCommit() + { + pdoc->TentativeCommit(); +- pdoc->decorations.SetCurrentIndicator(INDIC_IME); ++ pdoc->DecorationSetCurrentIndicator(INDIC_IME); + pdoc->DecorationFillRange(0, 0, pdoc->Length()); + } + +diff -r 284cc3b0e754 -r c105254dae66 gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Fri Mar 31 19:56:41 2017 +1100 ++++ b/gtk/ScintillaGTK.cxx Fri Mar 31 23:07:29 2017 +1100 +@@ -2227,7 +2227,7 @@ + if (indicator < 8 || indicator > INDIC_MAX) { + return; + } +- pdoc->decorations.SetCurrentIndicator(indicator); ++ pdoc->DecorationSetCurrentIndicator(indicator); + for (size_t r=0; r<sel.Count(); r++) { + int positionInsert = sel.Range(r).Start().Position(); + pdoc->DecorationFillRange(positionInsert - len, 1, len); +diff -r 284cc3b0e754 -r c105254dae66 qt/ScintillaEditBase/ScintillaEditBase.cpp +--- a/qt/ScintillaEditBase/ScintillaEditBase.cpp Fri Mar 31 19:56:41 2017 +1100 ++++ b/qt/ScintillaEditBase/ScintillaEditBase.cpp Fri Mar 31 23:07:29 2017 +1100 +@@ -451,7 +451,7 @@ + if (indicator < 8 || indicator > INDIC_MAX) { + return; + } +- sqt->pdoc->decorations.SetCurrentIndicator(indicator); ++ sqt->pdoc->DecorationSetCurrentIndicator(indicator); + for (size_t r=0; r< sqt-> sel.Count(); r++) { + int positionInsert = sqt->sel.Range(r).Start().Position(); + sqt->pdoc->DecorationFillRange(positionInsert - len, 1, len); +diff -r 284cc3b0e754 -r c105254dae66 src/Document.cxx +--- a/src/Document.cxx Fri Mar 31 19:56:41 2017 +1100 ++++ b/src/Document.cxx Fri Mar 31 23:07:29 2017 +1100 +@@ -2221,6 +2221,10 @@ + styleClock = (styleClock + 1) % 0x100000; + } + ++void SCI_METHOD Document::DecorationSetCurrentIndicator(int indicator) { ++ decorations.SetCurrentIndicator(indicator); ++} ++ + void SCI_METHOD Document::DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) { + if (decorations.FillRange(position, value, fillLength)) { + DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER, +diff -r 284cc3b0e754 -r c105254dae66 src/Document.h +--- a/src/Document.h Fri Mar 31 19:56:41 2017 +1100 ++++ b/src/Document.h Fri Mar 31 23:07:29 2017 +1100 +@@ -410,9 +410,7 @@ + void LexerChanged(); + int GetStyleClock() const { return styleClock; } + void IncrementStyleClock(); +- void SCI_METHOD DecorationSetCurrentIndicator(int indicator) { +- decorations.SetCurrentIndicator(indicator); +- } ++ void SCI_METHOD DecorationSetCurrentIndicator(int indicator); + void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength); + + int SCI_METHOD SetLineState(Sci_Position line, int state); +diff -r 284cc3b0e754 -r c105254dae66 src/Editor.cxx +--- a/src/Editor.cxx Fri Mar 31 19:56:41 2017 +1100 ++++ b/src/Editor.cxx Fri Mar 31 23:07:29 2017 +1100 +@@ -7354,7 +7354,7 @@ + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].outlineAlpha : 0; + + case SCI_SETINDICATORCURRENT: +- pdoc->decorations.SetCurrentIndicator(static_cast<int>(wParam)); ++ pdoc->DecorationSetCurrentIndicator(static_cast<int>(wParam)); + break; + case SCI_GETINDICATORCURRENT: + return pdoc->decorations.GetCurrentIndicator(); +diff -r 284cc3b0e754 -r c105254dae66 win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Fri Mar 31 19:56:41 2017 +1100 ++++ b/win32/ScintillaWin.cxx Fri Mar 31 23:07:29 2017 +1100 +@@ -906,7 +906,7 @@ + if (indicator < 8 || indicator > INDIC_MAX) { + return; + } +- pdoc->decorations.SetCurrentIndicator(indicator); ++ pdoc->DecorationSetCurrentIndicator(indicator); + for (size_t r=0; r<sel.Count(); r++) { + Sci::Position positionInsert = sel.Range(r).Start().Position(); + pdoc->DecorationFillRange(positionInsert - len, 1, len); diff --git a/src/scintilla_backports/6156_152e56f0b392.patch b/src/scintilla_backports/6156_152e56f0b392.patch new file mode 100644 index 00000000..a1d7a4e8 --- /dev/null +++ b/src/scintilla_backports/6156_152e56f0b392.patch @@ -0,0 +1,239 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1490962865 -39600 +# Node ID 152e56f0b392ab3143b697c8a057ac1d79533366 +# Parent c105254dae66064fe4898cc13f409c7abfc1edab +Prefer standard min/max over Platform's as adapts to changed types. + +diff -r c105254dae66 -r 152e56f0b392 cocoa/ScintillaCocoa.mm +--- a/cocoa/ScintillaCocoa.mm Fri Mar 31 23:07:29 2017 +1100 ++++ b/cocoa/ScintillaCocoa.mm Fri Mar 31 23:21:05 2017 +1100 +@@ -1263,7 +1263,7 @@ + // TODO: does not work for wrapped lines, fix it. + Sci::Line line = pdoc->LineFromPosition(posDrag.Position()); + Sci::Line currentVisibleLine = cs.DisplayFromDoc(line); +- Sci::Line lastVisibleLine = Platform::Minimum(topLine + LinesOnScreen(), cs.LinesDisplayed()) - 2; ++ Sci::Line lastVisibleLine = std::min(topLine + LinesOnScreen(), cs.LinesDisplayed()) - 2; + + if (currentVisibleLine <= topLine && topLine > 0) + ScrollTo(topLine - scrollSpeed); +diff -r c105254dae66 -r 152e56f0b392 src/CallTip.cxx +--- a/src/CallTip.cxx Fri Mar 31 23:07:29 2017 +1100 ++++ b/src/CallTip.cxx Fri Mar 31 23:21:05 2017 +1100 +@@ -11,6 +11,7 @@ + + #include <stdexcept> + #include <string> ++#include <algorithm> + + #include "Platform.h" + +@@ -191,11 +192,11 @@ + int chunkOffset = static_cast<int>(chunkVal - val.c_str()); + int chunkLength = static_cast<int>(chunkEnd - chunkVal); + int chunkEndOffset = chunkOffset + chunkLength; +- int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset); +- thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset); ++ int thisStartHighlight = std::max(startHighlight, chunkOffset); ++ thisStartHighlight = std::min(thisStartHighlight, chunkEndOffset); + thisStartHighlight -= chunkOffset; +- int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset); +- thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset); ++ int thisEndHighlight = std::max(endHighlight, chunkOffset); ++ thisEndHighlight = std::min(thisEndHighlight, chunkEndOffset); + thisEndHighlight -= chunkOffset; + rcClient.top = static_cast<XYPOSITION>(ytext - ascent - 1); + +@@ -211,7 +212,7 @@ + chunkVal = chunkEnd + 1; + ytext += lineHeight; + rcClient.bottom += lineHeight; +- maxWidth = Platform::Maximum(maxWidth, x); ++ maxWidth = std::max(maxWidth, x); + } + return maxWidth; + } +diff -r c105254dae66 -r 152e56f0b392 src/Document.cxx +--- a/src/Document.cxx Fri Mar 31 23:07:29 2017 +1100 ++++ b/src/Document.cxx Fri Mar 31 23:21:05 2017 +1100 +@@ -448,7 +448,7 @@ + if (level == -1) + level = LevelNumber(GetLevel(lineParent)); + Sci::Line maxLine = LinesTotal(); +- Sci::Line lookLastLine = (lastLine != -1) ? Platform::Minimum(LinesTotal() - 1, lastLine) : -1; ++ Sci::Line lookLastLine = (lastLine != -1) ? std::min(LinesTotal() - 1, lastLine) : -1; + Sci::Line lineMaxSubord = lineParent; + while (lineMaxSubord < maxLine - 1) { + EnsureStyledTo(LineStart(lineMaxSubord + 2)); +@@ -488,7 +488,7 @@ + + void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, Sci::Line line, Sci::Line lastLine) { + int level = GetLevel(line); +- Sci::Line lookLastLine = Platform::Maximum(line, lastLine) + 1; ++ Sci::Line lookLastLine = std::max(line, lastLine) + 1; + + Sci::Line lookLine = line; + int lookLineLevel = level; +@@ -1863,7 +1863,7 @@ + const Sci::Position lengthFind = *length; + + //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); +- const Sci::Position limitPos = Platform::Maximum(startPos, endPos); ++ const Sci::Position limitPos = std::max(startPos, endPos); + Sci::Position pos = startPos; + if (!forward) { + // Back all of a character +diff -r c105254dae66 -r 152e56f0b392 src/EditView.cxx +--- a/src/EditView.cxx Fri Mar 31 23:07:29 2017 +1100 ++++ b/src/EditView.cxx Fri Mar 31 23:21:05 2017 +1100 +@@ -1780,7 +1780,7 @@ + // Find the most recent line with some text + + Sci::Line lineLastWithText = line; +- while (lineLastWithText > Platform::Maximum(line - 20, 0) && model.pdoc->IsWhiteLine(lineLastWithText)) { ++ while (lineLastWithText > std::max(line - 20, 0) && model.pdoc->IsWhiteLine(lineLastWithText)) { + lineLastWithText--; + } + if (lineLastWithText < line) { +@@ -1795,21 +1795,21 @@ + if (vsDraw.viewIndentationGuides == ivLookForward) { + // In viLookForward mode, previous line only used if it is a fold header + if (isFoldHeader) { +- indentSpace = Platform::Maximum(indentSpace, indentLastWithText); ++ indentSpace = std::max(indentSpace, indentLastWithText); + } + } else { // viLookBoth +- indentSpace = Platform::Maximum(indentSpace, indentLastWithText); ++ indentSpace = std::max(indentSpace, indentLastWithText); + } + } + + Sci::Line lineNextWithText = line; +- while (lineNextWithText < Platform::Minimum(line + 20, model.pdoc->LinesTotal()) && model.pdoc->IsWhiteLine(lineNextWithText)) { ++ while (lineNextWithText < std::min(line + 20, model.pdoc->LinesTotal()) && model.pdoc->IsWhiteLine(lineNextWithText)) { + lineNextWithText++; + } + if (lineNextWithText > line) { + xStartText = 100000; // Don't limit to visible indentation on empty line + // This line is empty, so use indentation of first next line with text +- indentSpace = Platform::Maximum(indentSpace, ++ indentSpace = std::max(indentSpace, + model.pdoc->GetLineIndentation(lineNextWithText)); + } + +@@ -2050,7 +2050,7 @@ + surfaceWindow->Copy(rcCopyArea, from, *pixmapLine); + } + +- lineWidthMaxSeen = Platform::Maximum( ++ lineWidthMaxSeen = std::max( + lineWidthMaxSeen, static_cast<int>(ll->positions[ll->numCharsInLine])); + //durCopy += et.Duration(true); + } +@@ -2140,7 +2140,7 @@ + r = r * il / l; + g = g * il / l; + b = b * il / l; +- return ColourDesired(Platform::Minimum(r, 0xff), Platform::Minimum(g, 0xff), Platform::Minimum(b, 0xff)); ++ return ColourDesired(std::min(r, 0xffu), std::min(g, 0xffu), std::min(b, 0xffu)); + } + + long EditView::FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, +diff -r c105254dae66 -r 152e56f0b392 src/Editor.cxx +--- a/src/Editor.cxx Fri Mar 31 23:07:29 2017 +1100 ++++ b/src/Editor.cxx Fri Mar 31 23:21:05 2017 +1100 +@@ -600,16 +600,16 @@ + if (sel.Count() > 1 || !(sel.RangeMain().anchor == newMain.anchor) || sel.IsRectangular()) { + invalidateWholeSelection = true; + } +- Sci::Position firstAffected = Platform::Minimum(sel.RangeMain().Start().Position(), newMain.Start().Position()); ++ Sci::Position firstAffected = std::min(sel.RangeMain().Start().Position(), newMain.Start().Position()); + // +1 for lastAffected ensures caret repainted +- Sci::Position lastAffected = Platform::Maximum(newMain.caret.Position()+1, newMain.anchor.Position()); +- lastAffected = Platform::Maximum(lastAffected, sel.RangeMain().End().Position()); ++ Sci::Position lastAffected = std::max(newMain.caret.Position()+1, newMain.anchor.Position()); ++ lastAffected = std::max(lastAffected, sel.RangeMain().End().Position()); + if (invalidateWholeSelection) { + for (size_t r=0; r<sel.Count(); r++) { +- firstAffected = Platform::Minimum(firstAffected, sel.Range(r).caret.Position()); +- firstAffected = Platform::Minimum(firstAffected, sel.Range(r).anchor.Position()); +- lastAffected = Platform::Maximum(lastAffected, sel.Range(r).caret.Position()+1); +- lastAffected = Platform::Maximum(lastAffected, sel.Range(r).anchor.Position()); ++ firstAffected = std::min(firstAffected, sel.Range(r).caret.Position()); ++ firstAffected = std::min(firstAffected, sel.Range(r).anchor.Position()); ++ lastAffected = std::max(lastAffected, sel.Range(r).caret.Position()+1); ++ lastAffected = std::max(lastAffected, sel.Range(r).anchor.Position()); + } + } + ContainerNeedsUpdate(SC_UPDATE_SELECTION); +@@ -1132,7 +1132,7 @@ + if ((options & xysVertical) && (pt.y < rcClient.top || ptBottomCaret.y >= rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) { + const Sci::Line lineCaret = DisplayFromPosition(range.caret.Position()); + const Sci::Line linesOnScreen = LinesOnScreen(); +- const Sci::Line halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2; ++ const Sci::Line halfScreen = std::max(linesOnScreen - 1, 2) / 2; + const bool bSlop = (caretYPolicy & CARET_SLOP) != 0; + const bool bStrict = (caretYPolicy & CARET_STRICT) != 0; + const bool bJump = (caretYPolicy & CARET_JUMPS) != 0; +@@ -1231,7 +1231,7 @@ + + // Horizontal positioning + if ((options & xysHorizontal) && !Wrapping()) { +- const int halfScreen = Platform::Maximum(static_cast<int>(rcClient.Width()) - 4, 4) / 2; ++ const int halfScreen = std::max(static_cast<int>(rcClient.Width()) - 4, 4) / 2; + const bool bSlop = (caretXPolicy & CARET_SLOP) != 0; + const bool bStrict = (caretXPolicy & CARET_STRICT) != 0; + const bool bJump = (caretXPolicy & CARET_JUMPS) != 0; +@@ -2101,7 +2101,7 @@ + // Save next in case deco deleted + Decoration *decoNext = deco->next; + if (deco->indicator < INDIC_CONTAINER) { +- pdoc->decorations.SetCurrentIndicator(deco->indicator); ++ pdoc->DecorationSetCurrentIndicator(deco->indicator); + pdoc->DecorationFillRange(0, 0, pdoc->Length()); + } + deco = decoNext; +@@ -3906,8 +3906,8 @@ + Sci::Position anchorPosOnLine = sel.Range(r).anchor.Position() - pdoc->LineStart(lineOfAnchor); + Sci::Position currentPosPosOnLine = caretPosition - pdoc->LineStart(lineCurrentPos); + // Multiple lines selected so indent / dedent +- Sci::Line lineTopSel = Platform::Minimum(lineOfAnchor, lineCurrentPos); +- Sci::Line lineBottomSel = Platform::Maximum(lineOfAnchor, lineCurrentPos); ++ Sci::Line lineTopSel = std::min(lineOfAnchor, lineCurrentPos); ++ Sci::Line lineBottomSel = std::max(lineOfAnchor, lineCurrentPos); + if (pdoc->LineStart(lineBottomSel) == sel.Range(r).anchor.Position() || pdoc->LineStart(lineBottomSel) == caretPosition) + lineBottomSel--; // If not selecting any characters on a line, do not indent + pdoc->Indent(forwards, lineBottomSel, lineTopSel); +@@ -6262,7 +6262,7 @@ + return sel.LimitsForRectangularElseMain().start.Position(); + + case SCI_SETSELECTIONEND: +- SetSelection(static_cast<Sci::Position>(wParam), Platform::Minimum(sel.MainAnchor(), static_cast<Sci::Position>(wParam))); ++ SetSelection(static_cast<Sci::Position>(wParam), std::min(sel.MainAnchor(), static_cast<Sci::Position>(wParam))); + break; + + case SCI_GETSELECTIONEND: +diff -r c105254dae66 -r 152e56f0b392 src/ScintillaBase.cxx +--- a/src/ScintillaBase.cxx Fri Mar 31 23:07:29 2017 +1100 ++++ b/src/ScintillaBase.cxx Fri Mar 31 23:21:05 2017 +1100 +@@ -288,7 +288,7 @@ + rcac.top = pt.y + vs.lineHeight; + } + rcac.right = rcac.left + widthLB; +- rcac.bottom = static_cast<XYPOSITION>(Platform::Minimum(static_cast<int>(rcac.top) + heightLB, static_cast<int>(rcPopupBounds.bottom))); ++ rcac.bottom = static_cast<XYPOSITION>(std::min(static_cast<int>(rcac.top) + heightLB, static_cast<int>(rcPopupBounds.bottom))); + ac.lb->SetPositionRelative(rcac, wMain); + ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font); + unsigned int aveCharWidth = static_cast<unsigned int>(vs.styles[STYLE_DEFAULT].aveCharWidth); +@@ -300,9 +300,9 @@ + // Fiddle the position of the list so it is right next to the target and wide enough for all its strings + PRectangle rcList = ac.lb->GetDesiredRect(); + int heightAlloced = static_cast<int>(rcList.bottom - rcList.top); +- widthLB = Platform::Maximum(widthLB, static_cast<int>(rcList.right - rcList.left)); ++ widthLB = std::max(widthLB, static_cast<int>(rcList.right - rcList.left)); + if (maxListWidth != 0) +- widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth); ++ widthLB = std::min(widthLB, static_cast<int>(aveCharWidth)*maxListWidth); + // Make an allowance for large strings in list + rcList.left = pt.x - ac.lb->CaretFromEdge(); + rcList.right = rcList.left + widthLB; diff --git a/src/scintilla_backports/6157_35d652a3344b.patch b/src/scintilla_backports/6157_35d652a3344b.patch new file mode 100644 index 00000000..d6cebe9c --- /dev/null +++ b/src/scintilla_backports/6157_35d652a3344b.patch @@ -0,0 +1,881 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491003839 -39600 +# Node ID 35d652a3344bede120f1c59d9dc0b453a11c736b +# Parent 152e56f0b392ab3143b697c8a057ac1d79533366 +Standardize on C++ headers, remove headers that aren't needed and add <cstddef> +where it may be needed in the future. + +diff -r 152e56f0b392 -r 35d652a3344b cocoa/PlatCocoa.h +--- a/cocoa/PlatCocoa.h Fri Mar 31 23:21:05 2017 +1100 ++++ b/cocoa/PlatCocoa.h Sat Apr 01 10:43:59 2017 +1100 +@@ -7,11 +7,10 @@ + #ifndef PLATCOCOA_H + #define PLATCOCOA_H + +-#include <assert.h> +- + #include <sys/time.h> + + #include <cstdlib> ++#include <cassert> + #include <cstring> + #include <cstdio> + +diff -r 152e56f0b392 -r 35d652a3344b cocoa/PlatCocoa.mm +--- a/cocoa/PlatCocoa.mm Fri Mar 31 23:21:05 2017 +1100 ++++ b/cocoa/PlatCocoa.mm Sat Apr 01 10:43:59 2017 +1100 +@@ -12,10 +12,11 @@ + * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). + */ + +-#include <assert.h> + #include <sys/time.h> + ++#include <cstddef> + #include <cstdlib> ++#include <cassert> + #include <cstring> + #include <cstdio> + +diff -r 152e56f0b392 -r 35d652a3344b cocoa/ScintillaCocoa.h +--- a/cocoa/ScintillaCocoa.h Fri Mar 31 23:21:05 2017 +1100 ++++ b/cocoa/ScintillaCocoa.h Sat Apr 01 10:43:59 2017 +1100 +@@ -13,10 +13,11 @@ + * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). + */ + +-#include <stdlib.h> +-#include <stdio.h> +-#include <time.h> +-#include <ctype.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cctype> ++#include <cstdio> ++#include <ctime> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b gtk/PlatGTK.cxx +--- a/gtk/PlatGTK.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/gtk/PlatGTK.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -3,11 +3,11 @@ + // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stddef.h> +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <math.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cstring> ++#include <cstdio> ++#include <cmath> + + #include <string> + #include <vector> +diff -r 152e56f0b392 -r 35d652a3344b gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/gtk/ScintillaGTK.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -3,13 +3,14 @@ + // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <time.h> +-#include <math.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> ++#include <cctype> ++#include <cstdio> ++#include <ctime> ++#include <cmath> + + #include <stdexcept> + #include <new> +diff -r 152e56f0b392 -r 35d652a3344b gtk/ScintillaGTKAccessible.cxx +--- a/gtk/ScintillaGTKAccessible.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -51,8 +51,9 @@ + + // FIXME: optimize character/byte offset conversion (with a cache?) + +-#include <stdlib.h> +-#include <string.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cstring> + + #include <stdexcept> + #include <new> +diff -r 152e56f0b392 -r 35d652a3344b lexlib/Accessor.cxx +--- a/lexlib/Accessor.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/lexlib/Accessor.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,12 +5,8 @@ + // Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cassert> + + #include "ILexer.h" + #include "Scintilla.h" +diff -r 152e56f0b392 -r 35d652a3344b lexlib/CharacterSet.cxx +--- a/lexlib/CharacterSet.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/lexlib/CharacterSet.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -6,11 +6,8 @@ + // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cassert> + + #include "CharacterSet.h" + +diff -r 152e56f0b392 -r 35d652a3344b lexlib/LexerBase.cxx +--- a/lexlib/LexerBase.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/lexlib/LexerBase.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,12 +5,9 @@ + // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> + + #include "ILexer.h" + #include "Scintilla.h" +diff -r 152e56f0b392 -r 35d652a3344b lexlib/LexerModule.cxx +--- a/lexlib/LexerModule.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/lexlib/LexerModule.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,12 +5,8 @@ + // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cassert> + + #include <string> + +diff -r 152e56f0b392 -r 35d652a3344b lexlib/LexerNoExceptions.cxx +--- a/lexlib/LexerNoExceptions.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/lexlib/LexerNoExceptions.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,12 +5,8 @@ + // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cassert> + + #include "ILexer.h" + #include "Scintilla.h" +diff -r 152e56f0b392 -r 35d652a3344b lexlib/LexerSimple.cxx +--- a/lexlib/LexerSimple.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/lexlib/LexerSimple.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,12 +5,8 @@ + // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cassert> + + #include <string> + +diff -r 152e56f0b392 -r 35d652a3344b lexlib/PropSetSimple.cxx +--- a/lexlib/PropSetSimple.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/lexlib/PropSetSimple.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -7,9 +7,8 @@ + + // Maintain a dictionary of properties + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> ++#include <cstdlib> ++#include <cstring> + + #include <string> + #include <map> +diff -r 152e56f0b392 -r 35d652a3344b lexlib/StyleContext.cxx +--- a/lexlib/StyleContext.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/lexlib/StyleContext.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,11 +5,9 @@ + // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org> + // This file is in the public domain. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cassert> ++#include <cctype> + + #include "ILexer.h" + +diff -r 152e56f0b392 -r 35d652a3344b lexlib/WordList.cxx +--- a/lexlib/WordList.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/lexlib/WordList.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,11 +5,8 @@ + // Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cstring> + + #include <algorithm> + +diff -r 152e56f0b392 -r 35d652a3344b qt/ScintillaEditBase/ScintillaQt.h +--- a/qt/ScintillaEditBase/ScintillaQt.h Fri Mar 31 23:21:05 2017 +1100 ++++ b/qt/ScintillaEditBase/ScintillaQt.h Sat Apr 01 10:43:59 2017 +1100 +@@ -11,12 +11,13 @@ + #ifndef SCINTILLAQT_H + #define SCINTILLAQT_H + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <assert.h> +-#include <ctype.h> +-#include <time.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> ++#include <cctype> ++#include <cstdio> ++#include <ctime> + #include <cmath> + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b scripts/HeaderOrder.txt +--- a/scripts/HeaderOrder.txt Fri Mar 31 23:21:05 2017 +1100 ++++ b/scripts/HeaderOrder.txt Sat Apr 01 10:43:59 2017 +1100 +@@ -17,13 +17,17 @@ + #include <sys/time.h> + + // C++ wrappers of C standard library ++#include <cstddef> + #include <cstdlib> ++#include <cstdint> + #include <cassert> + #include <cstring> + #include <cctype> + #include <cstdio> + #include <cstdarg> ++#include <ctime> + #include <cmath> ++#include <climits> + + // C++ standard library + #include <stdexcept> +diff -r 152e56f0b392 -r 35d652a3344b src/AutoComplete.cxx +--- a/src/AutoComplete.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/AutoComplete.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,10 +5,10 @@ + // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <assert.h> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> ++#include <cstdio> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/CallTip.cxx +--- a/src/CallTip.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/CallTip.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,9 +5,9 @@ + // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> ++#include <cstdlib> ++#include <cstring> ++#include <cstdio> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/Catalogue.cxx +--- a/src/Catalogue.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/Catalogue.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,12 +5,9 @@ + // Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> + + #include <stdexcept> + #include <vector> +diff -r 152e56f0b392 -r 35d652a3344b src/CellBuffer.cxx +--- a/src/CellBuffer.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/CellBuffer.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,10 +5,11 @@ + // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cstring> ++#include <cstdio> ++#include <cstdarg> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b src/CharClassify.cxx +--- a/src/CharClassify.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/CharClassify.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,8 +5,8 @@ + // Copyright 2006 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cctype> + + #include <stdexcept> + +diff -r 152e56f0b392 -r 35d652a3344b src/ContractionState.cxx +--- a/src/ContractionState.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/ContractionState.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,8 +5,9 @@ + // Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <string.h> +-#include <assert.h> ++#include <cstddef> ++#include <cassert> ++#include <cstring> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b src/Decoration.cxx +--- a/src/Decoration.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/Decoration.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -4,10 +4,11 @@ + // Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cstring> ++#include <cstdio> ++#include <cstdarg> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b src/Document.cxx +--- a/src/Document.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/Document.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,11 +5,11 @@ + // Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> ++#include <cstdio> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/EditModel.cxx +--- a/src/EditModel.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/EditModel.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,12 +5,10 @@ + // Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <math.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cassert> ++#include <cmath> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/EditView.cxx +--- a/src/EditView.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/EditView.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,12 +5,13 @@ + // Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <math.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> ++#include <cctype> ++#include <cstdio> ++#include <cmath> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/Editor.cxx +--- a/src/Editor.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/Editor.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,11 +5,12 @@ + // Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> ++#include <cctype> ++#include <cstdio> + + #include <cmath> + #include <stdexcept> +diff -r 152e56f0b392 -r 35d652a3344b src/ExternalLexer.cxx +--- a/src/ExternalLexer.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/ExternalLexer.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,11 +5,9 @@ + // Copyright 2001 Simon Steele <ss@pnotepad.org>, portions copyright Neil Hodgson. + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/KeyMap.cxx +--- a/src/KeyMap.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/KeyMap.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,7 +5,7 @@ + // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> ++#include <cstdlib> + + #include <stdexcept> + #include <vector> +diff -r 152e56f0b392 -r 35d652a3344b src/LineMarker.cxx +--- a/src/LineMarker.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/LineMarker.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,8 +5,8 @@ + // Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <string.h> +-#include <math.h> ++#include <cstring> ++#include <cmath> + + #include <stdexcept> + #include <vector> +diff -r 152e56f0b392 -r 35d652a3344b src/MarginView.cxx +--- a/src/MarginView.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/MarginView.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,12 +5,13 @@ + // Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <math.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> ++#include <cctype> ++#include <cstdio> ++#include <cmath> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/PerLine.cxx +--- a/src/PerLine.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/PerLine.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,7 +5,8 @@ + // Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <string.h> ++#include <cstddef> ++#include <cstring> + + #include <stdexcept> + #include <vector> +diff -r 152e56f0b392 -r 35d652a3344b src/PositionCache.cxx +--- a/src/PositionCache.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/PositionCache.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,10 +5,9 @@ + // Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <ctype.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cstring> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/RESearch.cxx +--- a/src/RESearch.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/RESearch.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -200,7 +200,7 @@ + * matches: foo-foo fo-fo fob-fob foobar-foobar ... + */ + +-#include <stdlib.h> ++#include <cstdlib> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/RunStyles.cxx +--- a/src/RunStyles.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/RunStyles.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -4,10 +4,11 @@ + // Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cstring> ++#include <cstdio> ++#include <cstdarg> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b src/ScintillaBase.cxx +--- a/src/ScintillaBase.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/ScintillaBase.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,11 +5,10 @@ + // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <assert.h> +-#include <ctype.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/Selection.cxx +--- a/src/Selection.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/Selection.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,7 +5,7 @@ + // Copyright 2009 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> ++#include <cstdlib> + + #include <stdexcept> + #include <vector> +diff -r 152e56f0b392 -r 35d652a3344b src/Style.cxx +--- a/src/Style.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/Style.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,8 +5,6 @@ + // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <string.h> +- + #include <stdexcept> + + #include "Platform.h" +diff -r 152e56f0b392 -r 35d652a3344b src/UniConversion.cxx +--- a/src/UniConversion.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/UniConversion.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,7 +5,7 @@ + // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> ++#include <cstdlib> + + #include <stdexcept> + #include <string> +diff -r 152e56f0b392 -r 35d652a3344b src/ViewStyle.cxx +--- a/src/ViewStyle.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/ViewStyle.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,8 +5,9 @@ + // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <string.h> +-#include <assert.h> ++#include <cstddef> ++#include <cassert> ++#include <cstring> + + #include <stdexcept> + #include <vector> +diff -r 152e56f0b392 -r 35d652a3344b src/XPM.cxx +--- a/src/XPM.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/src/XPM.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,8 +5,8 @@ + // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> ++#include <cstdlib> ++#include <cstring> + + #include <stdexcept> + #include <vector> +diff -r 152e56f0b392 -r 35d652a3344b test/unit/testCharClassify.cxx +--- a/test/unit/testCharClassify.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/test/unit/testCharClassify.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -1,6 +1,6 @@ + // Unit Tests for Scintilla internal data structures + +-#include <string.h> ++#include <cstring> + + #include <algorithm> + #include <iostream> +diff -r 152e56f0b392 -r 35d652a3344b test/unit/testContractionState.cxx +--- a/test/unit/testContractionState.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/test/unit/testContractionState.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -1,6 +1,6 @@ + // Unit Tests for Scintilla internal data structures + +-#include <string.h> ++#include <cstring> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b test/unit/testDecoration.cxx +--- a/test/unit/testDecoration.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/test/unit/testDecoration.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -1,6 +1,6 @@ + // Unit Tests for Scintilla internal data structures + +-#include <string.h> ++#include <cstring> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b test/unit/testPartitioning.cxx +--- a/test/unit/testPartitioning.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/test/unit/testPartitioning.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -1,6 +1,6 @@ + // Unit Tests for Scintilla internal data structures + +-#include <string.h> ++#include <cstring> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b test/unit/testRunStyles.cxx +--- a/test/unit/testRunStyles.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/test/unit/testRunStyles.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -1,6 +1,6 @@ + // Unit Tests for Scintilla internal data structures + +-#include <string.h> ++#include <cstring> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b test/unit/testSparseVector.cxx +--- a/test/unit/testSparseVector.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/test/unit/testSparseVector.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -1,8 +1,7 @@ + // Unit Tests for Scintilla internal data structures + +-#include <string.h> +- + #include <cassert> ++#include <cstring> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b test/unit/testSplitVector.cxx +--- a/test/unit/testSplitVector.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/test/unit/testSplitVector.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -1,6 +1,6 @@ + // Unit Tests for Scintilla internal data structures + +-#include <string.h> ++#include <cstring> + + #include <stdexcept> + #include <algorithm> +diff -r 152e56f0b392 -r 35d652a3344b test/unit/testUnicodeFromUTF8.cxx +--- a/test/unit/testUnicodeFromUTF8.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/test/unit/testUnicodeFromUTF8.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -1,6 +1,6 @@ + // Unit Tests for Scintilla internal data structures + +-#include <string.h> ++#include <cstring> + + #include <algorithm> + +diff -r 152e56f0b392 -r 35d652a3344b win32/PlatWin.cxx +--- a/win32/PlatWin.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/win32/PlatWin.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,15 +5,15 @@ + // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stddef.h> +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <stdarg.h> +-#include <time.h> +-#include <math.h> +-#include <ctype.h> +-#include <limits.h> ++#include <cstddef> ++#include <cstdlib> ++#include <cstring> ++#include <cctype> ++#include <cstdio> ++#include <cstdarg> ++#include <ctime> ++#include <cmath> ++#include <climits> + + #include <vector> + #include <map> +diff -r 152e56f0b392 -r 35d652a3344b win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Fri Mar 31 23:21:05 2017 +1100 ++++ b/win32/ScintillaWin.cxx Sat Apr 01 10:43:59 2017 +1100 +@@ -5,14 +5,15 @@ + // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> + // The License.txt file describes the conditions under which this software may be distributed. + +-#include <stdlib.h> +-#include <string.h> +-#include <stdio.h> +-#include <assert.h> +-#include <ctype.h> +-#include <limits.h> +- ++#include <cstddef> ++#include <cstdlib> ++#include <cassert> ++#include <cstring> ++#include <cctype> ++#include <cstdio> + #include <cmath> ++#include <climits> ++ + #include <stdexcept> + #include <new> + #include <string> diff --git a/src/scintilla_backports/6158_47fa874827a5.patch b/src/scintilla_backports/6158_47fa874827a5.patch new file mode 100644 index 00000000..6a88ed94 --- /dev/null +++ b/src/scintilla_backports/6158_47fa874827a5.patch @@ -0,0 +1,280 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491012984 -39600 +# Node ID 47fa874827a53ca2595aab2df1efa17834f24e06 +# Parent 35d652a3344bede120f1c59d9dc0b453a11c736b +More encapsulation for Decoration and DecorationList. + +diff -r 35d652a3344b -r 47fa874827a5 src/Decoration.cxx +--- a/src/Decoration.cxx Sat Apr 01 10:43:59 2017 +1100 ++++ b/src/Decoration.cxx Sat Apr 01 13:16:24 2017 +1100 +@@ -26,7 +26,7 @@ + using namespace Scintilla; + #endif + +-Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) { ++Decoration::Decoration(int indicator_) : indicator(indicator_), next(0) { + } + + Decoration::~Decoration() { +@@ -43,7 +43,7 @@ + DecorationList::~DecorationList() { + Decoration *deco = root; + while (deco) { +- Decoration *decoNext = deco->next; ++ Decoration *decoNext = deco->Next(); + delete deco; + deco = decoNext; + } +@@ -52,8 +52,8 @@ + } + + Decoration *DecorationList::DecorationFromIndicator(int indicator) { +- for (Decoration *deco=root; deco; deco = deco->next) { +- if (deco->indicator == indicator) { ++ for (Decoration *deco=root; deco; deco = deco->Next()) { ++ if (deco->Indicator() == indicator) { + return deco; + } + } +@@ -68,9 +68,9 @@ + Decoration *decoPrev = 0; + Decoration *deco = root; + +- while (deco && (deco->indicator < indicator)) { ++ while (deco && (deco->Indicator() < indicator)) { + decoPrev = deco; +- deco = deco->next; ++ deco = deco->Next(); + } + if (decoPrev == 0) { + decoNew->next = root; +@@ -85,17 +85,17 @@ + void DecorationList::Delete(int indicator) { + Decoration *decoToDelete = 0; + if (root) { +- if (root->indicator == indicator) { ++ if (root->Indicator() == indicator) { + decoToDelete = root; +- root = root->next; ++ root = root->Next(); + } else { + Decoration *deco=root; +- while (deco->next && !decoToDelete) { +- if (deco->next && deco->next->indicator == indicator) { +- decoToDelete = deco->next; +- deco->next = decoToDelete->next; ++ while (deco->Next() && !decoToDelete) { ++ if (deco->Next() && deco->Next()->Indicator() == indicator) { ++ decoToDelete = deco->Next(); ++ deco->next = decoToDelete->Next(); + } else { +- deco = deco->next; ++ deco = deco->Next(); + } + } + } +@@ -133,7 +133,7 @@ + void DecorationList::InsertSpace(int position, int insertLength) { + const bool atEnd = position == lengthDocument; + lengthDocument += insertLength; +- for (Decoration *deco=root; deco; deco = deco->next) { ++ for (Decoration *deco=root; deco; deco = deco->Next()) { + deco->rs.InsertSpace(position, insertLength); + if (atEnd) { + deco->rs.FillRange(position, 0, insertLength); +@@ -144,7 +144,7 @@ + void DecorationList::DeleteRange(int position, int deleteLength) { + lengthDocument -= deleteLength; + Decoration *deco; +- for (deco=root; deco; deco = deco->next) { ++ for (deco=root; deco; deco = deco->Next()) { + deco->rs.DeleteRange(position, deleteLength); + } + DeleteAnyEmpty(); +@@ -154,20 +154,20 @@ + Decoration *deco = root; + while (deco) { + if ((lengthDocument == 0) || deco->Empty()) { +- Delete(deco->indicator); ++ Delete(deco->Indicator()); + deco = root; + } else { +- deco = deco->next; ++ deco = deco->Next(); + } + } + } + + int DecorationList::AllOnFor(int position) const { + int mask = 0; +- for (Decoration *deco=root; deco; deco = deco->next) { ++ for (Decoration *deco=root; deco; deco = deco->Next()) { + if (deco->rs.ValueAt(position)) { +- if (deco->indicator < INDIC_IME) { +- mask |= 1 << deco->indicator; ++ if (deco->Indicator() < INDIC_IME) { ++ mask |= 1 << deco->Indicator(); + } + } + } +diff -r 35d652a3344b -r 47fa874827a5 src/Decoration.h +--- a/src/Decoration.h Sat Apr 01 10:43:59 2017 +1100 ++++ b/src/Decoration.h Sat Apr 01 13:16:24 2017 +1100 +@@ -12,15 +12,21 @@ + #endif + + class Decoration { ++ int indicator; + public: + Decoration *next; + RunStyles rs; +- int indicator; + + explicit Decoration(int indicator_); + ~Decoration(); + + bool Empty() const; ++ Decoration *Next() const { ++ return next; ++ } ++ int Indicator() const { ++ return indicator; ++ } + }; + + class DecorationList { +@@ -32,13 +38,17 @@ + Decoration *Create(int indicator, int length); + void Delete(int indicator); + void DeleteAnyEmpty(); +-public: + Decoration *root; + bool clickNotified; ++public: + + DecorationList(); + ~DecorationList(); + ++ Decoration *Root() const { ++ return root; ++ } ++ + void SetCurrentIndicator(int indicator); + int GetCurrentIndicator() const { return currentIndicator; } + +@@ -55,6 +65,13 @@ + int ValueAt(int indicator, int position); + int Start(int indicator, int position); + int End(int indicator, int position); ++ ++ virtual bool ClickNotified() const { ++ return clickNotified; ++ } ++ virtual void SetClickNotified(bool notified) { ++ clickNotified = notified; ++ } + }; + + #ifdef SCI_NAMESPACE +diff -r 35d652a3344b -r 47fa874827a5 src/EditView.cxx +--- a/src/EditView.cxx Sat Apr 01 10:43:59 2017 +1100 ++++ b/src/EditView.cxx Sat Apr 01 13:16:24 2017 +1100 +@@ -1015,8 +1015,8 @@ + const Sci::Position lineStart = ll->LineStart(subLine); + const Sci::Position posLineEnd = posLineStart + lineEnd; + +- for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) { +- if (under == vsDraw.indicators[deco->indicator].under) { ++ for (Decoration *deco = model.pdoc->decorations.Root(); deco; deco = deco->Next()) { ++ if (under == vsDraw.indicators[deco->Indicator()].under) { + Sci::Position startPos = posLineStart + lineStart; + if (!deco->rs.ValueAt(startPos)) { + startPos = deco->rs.EndRun(startPos); +@@ -1024,12 +1024,12 @@ + while ((startPos < posLineEnd) && (deco->rs.ValueAt(startPos))) { + const Range rangeRun(deco->rs.StartRun(startPos), deco->rs.EndRun(startPos)); + const Sci::Position endPos = std::min(rangeRun.end, posLineEnd); +- const bool hover = vsDraw.indicators[deco->indicator].IsDynamic() && ++ const bool hover = vsDraw.indicators[deco->Indicator()].IsDynamic() && + rangeRun.ContainsCharacter(hoverIndicatorPos); + const int value = deco->rs.ValueAt(startPos); + Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal; + const Sci::Position posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1); +- DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart, ++ DrawIndicator(deco->Indicator(), startPos - posLineStart, endPos - posLineStart, + surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, drawState, value); + startPos = endPos; + if (!deco->rs.ValueAt(startPos)) { +@@ -1619,10 +1619,10 @@ + } + if (vsDraw.indicatorsSetFore > 0) { + // At least one indicator sets the text colour so see if it applies to this segment +- for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) { ++ for (Decoration *deco = model.pdoc->decorations.Root(); deco; deco = deco->Next()) { + const int indicatorValue = deco->rs.ValueAt(ts.start + posLineStart); + if (indicatorValue) { +- const Indicator &indicator = vsDraw.indicators[deco->indicator]; ++ const Indicator &indicator = vsDraw.indicators[deco->Indicator()]; + const bool hover = indicator.IsDynamic() && + ((model.hoverIndicatorPos >= ts.start + posLineStart) && + (model.hoverIndicatorPos <= ts.end() + posLineStart)); +diff -r 35d652a3344b -r 47fa874827a5 src/Editor.cxx +--- a/src/Editor.cxx Sat Apr 01 10:43:59 2017 +1100 ++++ b/src/Editor.cxx Sat Apr 01 13:16:24 2017 +1100 +@@ -2097,12 +2097,12 @@ + } + + void Editor::ClearDocumentStyle() { +- Decoration *deco = pdoc->decorations.root; ++ Decoration *deco = pdoc->decorations.Root(); + while (deco) { + // Save next in case deco deleted +- Decoration *decoNext = deco->next; +- if (deco->indicator < INDIC_CONTAINER) { +- pdoc->DecorationSetCurrentIndicator(deco->indicator); ++ Decoration *decoNext = deco->Next(); ++ if (deco->Indicator() < INDIC_CONTAINER) { ++ pdoc->DecorationSetCurrentIndicator(deco->Indicator()); + pdoc->DecorationFillRange(0, 0, pdoc->Length()); + } + deco = decoNext; +@@ -2407,9 +2407,9 @@ + + void Editor::NotifyIndicatorClick(bool click, Sci::Position position, int modifiers) { + int mask = pdoc->decorations.AllOnFor(position); +- if ((click && mask) || pdoc->decorations.clickNotified) { ++ if ((click && mask) || pdoc->decorations.ClickNotified()) { + SCNotification scn = {}; +- pdoc->decorations.clickNotified = click; ++ pdoc->decorations.SetClickNotified(click); + scn.nmhdr.code = click ? SCN_INDICATORCLICK : SCN_INDICATORRELEASE; + scn.modifiers = modifiers; + scn.position = position; +@@ -4622,9 +4622,9 @@ + if (vs.indicatorsDynamic == 0) + return; + if (position != INVALID_POSITION) { +- for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { +- if (vs.indicators[deco->indicator].IsDynamic()) { +- if (pdoc->decorations.ValueAt(deco->indicator, position)) { ++ for (Decoration *deco = pdoc->decorations.Root(); deco; deco = deco->Next()) { ++ if (vs.indicators[deco->Indicator()].IsDynamic()) { ++ if (pdoc->decorations.ValueAt(deco->Indicator(), position)) { + hoverIndicatorPos = position; + } + } +diff -r 35d652a3344b -r 47fa874827a5 src/PositionCache.cxx +--- a/src/PositionCache.cxx Sat Apr 01 10:43:59 2017 +1100 ++++ b/src/PositionCache.cxx Sat Apr 01 13:16:24 2017 +1100 +@@ -483,8 +483,8 @@ + } + } + if (pvsDraw && pvsDraw->indicatorsSetFore > 0) { +- for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { +- if (pvsDraw->indicators[deco->indicator].OverridesTextFore()) { ++ for (Decoration *deco = pdoc->decorations.Root(); deco; deco = deco->Next()) { ++ if (pvsDraw->indicators[deco->Indicator()].OverridesTextFore()) { + Sci::Position startPos = deco->rs.EndRun(posLineStart); + while (startPos < (posLineStart + lineRange.end)) { + Insert(startPos - posLineStart); diff --git a/src/scintilla_backports/6159_67865d8e5a37.patch b/src/scintilla_backports/6159_67865d8e5a37.patch new file mode 100644 index 00000000..66cee150 --- /dev/null +++ b/src/scintilla_backports/6159_67865d8e5a37.patch @@ -0,0 +1,31 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491013858 -39600 +# Node ID 67865d8e5a374e2cf9468e9b2638901342b1dca0 +# Parent 47fa874827a53ca2595aab2df1efa17834f24e06 +Fix DisplayFromPosition pos argument to be correct type. + +diff -r 47fa874827a5 -r 67865d8e5a37 src/EditView.cxx +--- a/src/EditView.cxx Sat Apr 01 13:16:24 2017 +1100 ++++ b/src/EditView.cxx Sat Apr 01 13:30:58 2017 +1100 +@@ -720,7 +720,7 @@ + return SelectionPosition(0); + } + +-Sci::Line EditView::DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs) { ++Sci::Line EditView::DisplayFromPosition(Surface *surface, const EditModel &model, Sci::Position pos, const ViewStyle &vs) { + Sci::Line lineDoc = model.pdoc->LineFromPosition(pos); + Sci::Line lineDisplay = model.cs.DisplayFromDoc(lineDoc); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); +diff -r 47fa874827a5 -r 67865d8e5a37 src/EditView.h +--- a/src/EditView.h Sat Apr 01 13:16:24 2017 +1100 ++++ b/src/EditView.h Sat Apr 01 13:30:58 2017 +1100 +@@ -117,7 +117,7 @@ + SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, + bool charPosition, bool virtualSpace, const ViewStyle &vs); + SelectionPosition SPositionFromLineX(Surface *surface, const EditModel &model, Sci::Line lineDoc, int x, const ViewStyle &vs); +- Sci::Line DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs); ++ Sci::Line DisplayFromPosition(Surface *surface, const EditModel &model, Sci::Position pos, const ViewStyle &vs); + Sci::Position StartEndDisplayLine(Surface *surface, const EditModel &model, Sci::Position pos, bool start, const ViewStyle &vs); + + void DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, Sci::Position start, PRectangle rcSegment, bool highlight); diff --git a/src/scintilla_backports/6160_a1a9cde51997.patch b/src/scintilla_backports/6160_a1a9cde51997.patch new file mode 100644 index 00000000..093ba79a --- /dev/null +++ b/src/scintilla_backports/6160_a1a9cde51997.patch @@ -0,0 +1,142 @@ +# HG changeset patch +# User Vicente +# Date 1491085058 -36000 +# Node ID a1a9cde519976fa12e46224d6cd57483bc4633ae +# Parent 67865d8e5a374e2cf9468e9b2638901342b1dca0 +Added "Reverse Selected Lines" as SCI_LINEREVERSE. + +diff -r 67865d8e5a37 -r a1a9cde51997 doc/ScintillaDoc.html +--- a/doc/ScintillaDoc.html Sat Apr 01 13:30:58 2017 +1100 ++++ b/doc/ScintillaDoc.html Sun Apr 02 08:17:38 2017 +1000 +@@ -5199,15 +5199,18 @@ + <td><code>SCI_DELLINERIGHT</code></td> + + <td><code>SCI_LINEDELETE</code></td> +- </tr> +- +- <tr> ++ + <td><code>SCI_LINECUT</code></td> ++ </tr> ++ ++ <tr> + + <td><code>SCI_LINECOPY</code></td> + + <td><code>SCI_LINETRANSPOSE</code></td> + ++ <td><code>SCI_LINEREVERSE</code></td> ++ + <td><code>SCI_LINEDUPLICATE</code></td> + </tr> + +diff -r 67865d8e5a37 -r a1a9cde51997 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Sat Apr 01 13:30:58 2017 +1100 ++++ b/doc/ScintillaHistory.html Sun Apr 02 08:17:38 2017 +1000 +@@ -527,6 +527,9 @@ + Released 21 March 2017. + </li> + <li> ++ Added "Reverse Selected Lines" feature. ++ </li> ++ <li> + Updated case conversion and character categories to Unicode 9. + </li> + <li> +diff -r 67865d8e5a37 -r a1a9cde51997 include/Scintilla.h +--- a/include/Scintilla.h Sat Apr 01 13:30:58 2017 +1100 ++++ b/include/Scintilla.h Sun Apr 02 08:17:38 2017 +1000 +@@ -638,6 +638,7 @@ + #define SCI_LINECUT 2337 + #define SCI_LINEDELETE 2338 + #define SCI_LINETRANSPOSE 2339 ++#define SCI_LINEREVERSE 2354 + #define SCI_LINEDUPLICATE 2404 + #define SCI_LOWERCASE 2340 + #define SCI_UPPERCASE 2341 +diff -r 67865d8e5a37 -r a1a9cde51997 include/Scintilla.iface +--- a/include/Scintilla.iface Sat Apr 01 13:30:58 2017 +1100 ++++ b/include/Scintilla.iface Sun Apr 02 08:17:38 2017 +1000 +@@ -1614,6 +1614,9 @@ + # Switch the current line with the previous. + fun void LineTranspose=2339(,) + ++# Reverse order of selected lines. ++fun void LineReverse=2354(,) ++ + # Duplicate the current line. + fun void LineDuplicate=2404(,) + +diff -r 67865d8e5a37 -r a1a9cde51997 src/Editor.cxx +--- a/src/Editor.cxx Sat Apr 01 13:30:58 2017 +1100 ++++ b/src/Editor.cxx Sun Apr 02 08:17:38 2017 +1000 +@@ -2800,6 +2800,7 @@ + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: ++ case SCI_LINEREVERSE: + case SCI_LINEDUPLICATE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: +@@ -2967,6 +2968,32 @@ + } + } + ++void Editor::LineReverse() { ++ const Sci::Line lineStart = pdoc->LineFromPosition(sel.RangeMain().Start().Position()); ++ const Sci::Line lineEnd = pdoc->LineFromPosition(sel.RangeMain().End().Position()-1); ++ const Sci::Line lineDiff = lineEnd - lineStart; ++ if (lineDiff <= 0) ++ return; ++ UndoGroup ug(pdoc); ++ for (Sci::Line i=(lineDiff+1)/2-1; i>=0; --i) { ++ const Sci::Line lineNum2 = lineEnd - i; ++ const Sci::Line lineNum1 = lineStart + i; ++ Sci::Position lineStart2 = pdoc->LineStart(lineNum2); ++ const Sci::Position lineStart1 = pdoc->LineStart(lineNum1); ++ const std::string line2 = RangeText(lineStart2, pdoc->LineEnd(lineNum2)); ++ const std::string line1 = RangeText(lineStart1, pdoc->LineEnd(lineNum1)); ++ const Sci::Position lineLen2 = static_cast<Sci::Position>(line2.length()); ++ const Sci::Position lineLen1 = static_cast<Sci::Position>(line1.length()); ++ pdoc->DeleteChars(lineStart2, lineLen2); ++ pdoc->DeleteChars(lineStart1, lineLen1); ++ lineStart2 -= lineLen1; ++ pdoc->InsertString(lineStart2, line1.c_str(), lineLen1); ++ pdoc->InsertString(lineStart1, line2.c_str(), lineLen2); ++ } ++ // Wholly select all affected lines ++ sel.RangeMain() = SelectionRange(pdoc->LineStart(lineStart), pdoc->LineStart(lineEnd+1)); ++} ++ + void Editor::Duplicate(bool forLine) { + if (sel.Empty()) { + forLine = true; +@@ -3809,6 +3836,9 @@ + case SCI_LINETRANSPOSE: + LineTranspose(); + break; ++ case SCI_LINEREVERSE: ++ LineReverse(); ++ break; + case SCI_LINEDUPLICATE: + Duplicate(true); + break; +@@ -7453,6 +7483,7 @@ + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: ++ case SCI_LINEREVERSE: + case SCI_LINEDUPLICATE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: +diff -r 67865d8e5a37 -r a1a9cde51997 src/Editor.h +--- a/src/Editor.h Sat Apr 01 13:30:58 2017 +1100 ++++ b/src/Editor.h Sun Apr 02 08:17:38 2017 +1000 +@@ -460,6 +460,7 @@ + virtual std::string CaseMapString(const std::string &s, int caseMapping); + void ChangeCaseOfSelection(int caseMapping); + void LineTranspose(); ++ void LineReverse(); + void Duplicate(bool forLine); + virtual void CancelModes(); + void NewLine(); diff --git a/src/scintilla_backports/6161_e7ca78c6f29c.patch b/src/scintilla_backports/6161_e7ca78c6f29c.patch new file mode 100644 index 00000000..cd8e88d4 --- /dev/null +++ b/src/scintilla_backports/6161_e7ca78c6f29c.patch @@ -0,0 +1,27 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491209937 -36000 +# Node ID e7ca78c6f29cf64c8c26e3e6ee2d63f4dbd48909 +# Parent a1a9cde519976fa12e46224d6cd57483bc4633ae +Prevent warning from MSVC Code Analysis. + +diff -r a1a9cde51997 -r e7ca78c6f29c src/Decoration.cxx +--- a/src/Decoration.cxx Sun Apr 02 08:17:38 2017 +1000 ++++ b/src/Decoration.cxx Mon Apr 03 18:58:57 2017 +1000 +@@ -89,10 +89,12 @@ + decoToDelete = root; + root = root->Next(); + } else { +- Decoration *deco=root; +- while (deco->Next() && !decoToDelete) { +- if (deco->Next() && deco->Next()->Indicator() == indicator) { +- decoToDelete = deco->Next(); ++ Decoration *deco = root; ++ while (deco && deco->Next() && !decoToDelete) { ++ // decoNext ensures no warning from MSVC Code Analysis ++ Decoration *decoNext = deco->Next(); ++ if (decoNext && deco->Next()->Indicator() == indicator) { ++ decoToDelete = decoNext; + deco->next = decoToDelete->Next(); + } else { + deco = deco->Next(); diff --git a/src/scintilla_backports/6167_797ed6c538fd.patch b/src/scintilla_backports/6167_797ed6c538fd.patch new file mode 100644 index 00000000..9231e7ca --- /dev/null +++ b/src/scintilla_backports/6167_797ed6c538fd.patch @@ -0,0 +1,296 @@ +# HG changeset patch +# User A-R-C-A +# Date 1491473963 -36000 +# Node ID 797ed6c538fdb3de395888cf46e847a617c48f60 +# Parent 4e0ed8a19851652ab7210bdc797d974447d82554 +Added a caret line frame as an alternative visual for highlighting the caret line. + +diff -r 4e0ed8a19851 -r 797ed6c538fd doc/ScintillaDoc.html +--- a/doc/ScintillaDoc.html Thu Apr 06 09:23:14 2017 +1000 ++++ b/doc/ScintillaDoc.html Thu Apr 06 20:19:23 2017 +1000 +@@ -3069,6 +3069,8 @@ + <a class="message" href="#SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK → colour</a><br /> + <a class="message" href="#SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(alpha alpha)</a><br /> + <a class="message" href="#SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA → int</a><br /> ++ <a class="message" href="#SCI_SETCARETLINEFRAME">SCI_SETCARETLINEFRAME(int width)</a><br /> ++ <a class="message" href="#SCI_GETCARETLINEFRAME">SCI_GETCARETLINEFRAME → int</a><br /> + <a class="message" href="#SCI_SETCARETLINEVISIBLEALWAYS">SCI_SETCARETLINEVISIBLEALWAYS(bool alwaysVisible)</a><br /> + <a class="message" href="#SCI_GETCARETLINEVISIBLEALWAYS">SCI_GETCARETLINEVISIBLEALWAYS → bool</a><br /> + <a class="message" href="#SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int periodMilliseconds)</a><br /> +@@ -3117,6 +3119,8 @@ + <b id="SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK → colour</b><br /> + <b id="SCI_SETCARETLINEBACKALPHA">SCI_SETCARETLINEBACKALPHA(<a class="jump" href="#alpha">alpha</a> alpha)</b><br /> + <b id="SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA → int</b><br /> ++ <b id="SCI_SETCARETLINEFRAME">SCI_SETCARETLINEFRAME(int width)</b><br /> ++ <b id="SCI_GETCARETLINEFRAME">SCI_GETCARETLINEFRAME → int</b><br /> + You can choose to make the background colour of the line containing the caret different with + these messages. To do this, set the desired background colour with + <code>SCI_SETCARETLINEBACK</code>, then use <code>SCI_SETCARETLINEVISIBLE(true)</code> to +@@ -3128,6 +3132,8 @@ + through. This is done by setting the alpha (translucency) value by calling + SCI_SETCARETLINEBACKALPHA. When the alpha is not SC_ALPHA_NOALPHA, + the caret line is drawn after all other features so will affect the colour of all other features. ++ Alternatively <code>SCI_SETCARETLINEFRAME</code> can be used to display the caret line framed ++ instead of filling the whole background. Set width != 0 to enable this option and width = 0 to disable it. + </p> + + <p><b id="SCI_SETCARETLINEVISIBLEALWAYS">SCI_SETCARETLINEVISIBLEALWAYS(bool alwaysVisible)</b><br /> +diff -r 4e0ed8a19851 -r 797ed6c538fd doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Thu Apr 06 09:23:14 2017 +1000 ++++ b/doc/ScintillaHistory.html Thu Apr 06 20:19:23 2017 +1000 +@@ -527,6 +527,9 @@ + Released 21 March 2017. + </li> + <li> ++ Added a caret line frame as an alternative visual for highlighting the caret line. ++ </li> ++ <li> + Added "Reverse Selected Lines" feature. + </li> + <li> +diff -r 4e0ed8a19851 -r 797ed6c538fd include/Scintilla.h +--- a/include/Scintilla.h Thu Apr 06 09:23:14 2017 +1000 ++++ b/include/Scintilla.h Thu Apr 06 20:19:23 2017 +1000 +@@ -329,6 +329,8 @@ + #define SCI_SETCARETLINEVISIBLE 2096 + #define SCI_GETCARETLINEBACK 2097 + #define SCI_SETCARETLINEBACK 2098 ++#define SCI_GETCARETLINEFRAME 2704 ++#define SCI_SETCARETLINEFRAME 2705 + #define SCI_STYLESETCHANGEABLE 2099 + #define SCI_AUTOCSHOW 2100 + #define SCI_AUTOCCANCEL 2101 +diff -r 4e0ed8a19851 -r 797ed6c538fd include/Scintilla.iface +--- a/include/Scintilla.iface Thu Apr 06 09:23:14 2017 +1000 ++++ b/include/Scintilla.iface Thu Apr 06 20:19:23 2017 +1000 +@@ -731,6 +731,14 @@ + # Set the colour of the background of the line containing the caret. + set void SetCaretLineBack=2098(colour back,) + ++# Retrieve the caret line frame width. ++# Width = 0 means this option is disabled. ++get int GetCaretLineFrame=2704(,) ++ ++# Display the caret line framed. ++# Set width != 0 to enable this option and width = 0 to disable it. ++set void SetCaretLineFrame=2705(int width,) ++ + # Set a style to be changeable or not (read only). + # Experimental feature, currently buggy. + set void StyleSetChangeable=2099(int style, bool changeable) +diff -r 4e0ed8a19851 -r 797ed6c538fd src/EditView.cxx +--- a/src/EditView.cxx Thu Apr 06 09:23:14 2017 +1000 ++++ b/src/EditView.cxx Thu Apr 06 20:19:23 2017 +1000 +@@ -836,6 +836,37 @@ + textBack, textFore); + } + ++static void DrawFrame(Surface *surface, ColourDesired colour, int alpha, PRectangle rcFrame) { ++ if (alpha != SC_ALPHA_NOALPHA) ++ surface->AlphaRectangle(rcFrame, 0, colour, alpha, colour, alpha, 0); ++ else ++ surface->FillRectangle(rcFrame, colour); ++} ++ ++static void DrawCaretLineFramed(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, int subLine) { ++ const int width = vsDraw.GetFrameWidth(); ++ if (subLine == 0 || ll->wrapIndent == 0 || vsDraw.caretLineAlpha != SC_ALPHA_NOALPHA) { ++ // Left ++ DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha, ++ PRectangle(rcLine.left, rcLine.top, rcLine.left + width, rcLine.bottom)); ++ } ++ if (subLine == 0) { ++ // Top ++ DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha, ++ PRectangle(rcLine.left + width, rcLine.top, rcLine.right - width, rcLine.top + width)); ++ } ++ if (subLine == ll->lines - 1 || vsDraw.caretLineAlpha != SC_ALPHA_NOALPHA) { ++ // Right ++ DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha, ++ PRectangle(rcLine.right - width, rcLine.top, rcLine.right, rcLine.bottom)); ++ } ++ if (subLine == ll->lines - 1) { ++ // Bottom ++ DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha, ++ PRectangle(rcLine.left + width, rcLine.bottom - width, rcLine.right - width, rcLine.bottom)); ++ } ++} ++ + void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + PRectangle rcLine, Sci::Line line, Sci::Position lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, + ColourOptional background) { +@@ -963,10 +994,16 @@ + + bool drawWrapMarkEnd = false; + +- if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_END) { +- if (subLine + 1 < ll->lines) { ++ if (subLine + 1 < ll->lines) { ++ if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_END) { + drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0; + } ++ if (vsDraw.IsLineFrameOpaque(model.caret.active, ll->containsCaret)) { ++ const int width = vsDraw.GetFrameWidth(); ++ // Draw right of frame under marker ++ DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha, ++ PRectangle(rcLine.right - width, rcLine.top, rcLine.right, rcLine.bottom)); ++ } + } + + if (drawWrapMarkEnd) { +@@ -1373,11 +1410,19 @@ + } + + static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll, +- int xStart, PRectangle rcLine, ColourOptional background, DrawWrapMarkerFn customDrawWrapMarker) { ++ int xStart, PRectangle rcLine, ColourOptional background, DrawWrapMarkerFn customDrawWrapMarker, ++ bool caretActive) { + // default bgnd here.. + surface->FillRectangle(rcLine, background.isSet ? background : + vsDraw.styles[STYLE_DEFAULT].back); + ++ if (vsDraw.IsLineFrameOpaque(caretActive, ll->containsCaret)) { ++ const int width = vsDraw.GetFrameWidth(); ++ // Draw left of frame under marker ++ DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha, ++ PRectangle(rcLine.left, rcLine.top, rcLine.left + width, rcLine.bottom)); ++ } ++ + if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_START) { + + // draw continuation rect +@@ -1551,9 +1596,14 @@ + + // Draw any translucent whole line states + static void DrawTranslucentLineState(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, +- Sci::Line line, PRectangle rcLine) { +- if ((model.caret.active || vsDraw.alwaysShowCaretLineBackground) && vsDraw.showCaretLineBackground && ll->containsCaret) { +- SimpleAlphaRectangle(surface, rcLine, vsDraw.caretLineBackground, vsDraw.caretLineAlpha); ++ Sci::Line line, PRectangle rcLine, int subLine) { ++ if ((model.caret.active || vsDraw.alwaysShowCaretLineBackground) && vsDraw.showCaretLineBackground && ll->containsCaret && ++ vsDraw.caretLineAlpha != SC_ALPHA_NOALPHA) { ++ if (vsDraw.caretLineFrame) { ++ DrawCaretLineFramed(surface, vsDraw, ll, rcLine, subLine); ++ } else { ++ SimpleAlphaRectangle(surface, rcLine, vsDraw.caretLineBackground, vsDraw.caretLineAlpha); ++ } + } + const int marksOfLine = model.pdoc->GetMark(line); + int marksDrawnInText = marksOfLine & vsDraw.maskDrawInText; +@@ -1842,7 +1892,7 @@ + + if ((ll->wrapIndent != 0) && (subLine > 0)) { + if (phase & drawBack) { +- DrawWrapIndentAndMarker(surface, vsDraw, ll, xStart, rcLine, background, customDrawWrapMarker); ++ DrawWrapIndentAndMarker(surface, vsDraw, ll, xStart, rcLine, background, customDrawWrapMarker, model.caret.active); + } + xStart += static_cast<int>(ll->wrapIndent); + } +@@ -1855,6 +1905,8 @@ + phase = static_cast<DrawPhase>(phase & ~drawBack); // Remove drawBack to not draw again in DrawFoldDisplayText + DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, + xStart, subLine, subLineStart, background); ++ if (vsDraw.IsLineFrameOpaque(model.caret.active, ll->containsCaret)) ++ DrawCaretLineFramed(surface, vsDraw, ll, rcLine, subLine); + } + + if (phase & drawIndicatorsBack) { +@@ -1882,6 +1934,8 @@ + if (phasesDraw == phasesOne) { + DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, + xStart, subLine, subLineStart, background); ++ if (vsDraw.IsLineFrameOpaque(model.caret.active, ll->containsCaret)) ++ DrawCaretLineFramed(surface, vsDraw, ll, rcLine, subLine); + DrawEdgeLine(surface, vsDraw, ll, rcLine, lineRange, xStart); + DrawMarkUnderline(surface, model, vsDraw, line, rcLine); + } +@@ -1891,7 +1945,7 @@ + } + + if (phase & drawLineTranslucent) { +- DrawTranslucentLineState(surface, model, vsDraw, ll, line, rcLine); ++ DrawTranslucentLineState(surface, model, vsDraw, ll, line, rcLine, subLine); + } + } + +diff -r 4e0ed8a19851 -r 797ed6c538fd src/Editor.cxx +--- a/src/Editor.cxx Thu Apr 06 09:23:14 2017 +1000 ++++ b/src/Editor.cxx Thu Apr 06 20:19:23 2017 +1000 +@@ -7067,6 +7067,12 @@ + InvalidateStyleRedraw(); + break; + ++ case SCI_GETCARETLINEFRAME: ++ return vs.caretLineFrame; ++ case SCI_SETCARETLINEFRAME: ++ vs.caretLineFrame = static_cast<int>(wParam); ++ InvalidateStyleRedraw(); ++ break; + case SCI_GETCARETLINEBACK: + return vs.caretLineBackground.AsLong(); + case SCI_SETCARETLINEBACK: +diff -r 4e0ed8a19851 -r 797ed6c538fd src/ViewStyle.cxx +--- a/src/ViewStyle.cxx Thu Apr 06 09:23:14 2017 +1000 ++++ b/src/ViewStyle.cxx Thu Apr 06 20:19:23 2017 +1000 +@@ -136,6 +136,7 @@ + selbarlight = source.selbarlight; + caretcolour = source.caretcolour; + additionalCaretColour = source.additionalCaretColour; ++ caretLineFrame = source.caretLineFrame; + showCaretLineBackground = source.showCaretLineBackground; + alwaysShowCaretLineBackground = source.alwaysShowCaretLineBackground; + caretLineBackground = source.caretLineBackground; +@@ -264,6 +265,7 @@ + styles[STYLE_LINENUMBER].back = Platform::Chrome(); + caretcolour = ColourDesired(0, 0, 0); + additionalCaretColour = ColourDesired(0x7f, 0x7f, 0x7f); ++ caretLineFrame = 0; + showCaretLineBackground = false; + alwaysShowCaretLineBackground = false; + caretLineBackground = ColourDesired(0xff, 0xff, 0); +@@ -479,6 +481,15 @@ + } + } + ++int ViewStyle::GetFrameWidth() const { ++ return Platform::Clamp(caretLineFrame, 1, lineHeight / 3); ++} ++ ++bool ViewStyle::IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const { ++ return caretLineFrame && (caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && ++ (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret; ++} ++ + // See if something overrides the line background color: Either if caret is on the line + // and background color is set for that, or if a marker is defined that forces its background + // color onto the line, or if a marker is defined but has no selection margin in which to +@@ -487,7 +498,8 @@ + // the color for the highest numbered one is used. + ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const { + ColourOptional background; +- if ((caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) { ++ if (!caretLineFrame && (caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && ++ (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) { + background = ColourOptional(caretLineBackground, true); + } + if (!background.isSet && marksOfLine) { +diff -r 4e0ed8a19851 -r 797ed6c538fd src/ViewStyle.h +--- a/src/ViewStyle.h Thu Apr 06 09:23:14 2017 +1000 ++++ b/src/ViewStyle.h Thu Apr 06 20:19:23 2017 +1000 +@@ -141,6 +141,7 @@ + bool viewEOL; + ColourDesired caretcolour; + ColourDesired additionalCaretColour; ++ int caretLineFrame; + bool showCaretLineBackground; + bool alwaysShowCaretLineBackground; + ColourDesired caretLineBackground; +@@ -190,6 +191,8 @@ + int MarginFromLocation(Point pt) const; + bool ValidStyle(size_t styleIndex) const; + void CalcLargestMarkerHeight(); ++ int GetFrameWidth() const; ++ bool IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const; + ColourOptional Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const; + bool SelectionBackgroundDrawn() const; + bool WhitespaceBackgroundDrawn() const; diff --git a/src/scintilla_backports/6168_d046ce80d590.patch b/src/scintilla_backports/6168_d046ce80d590.patch new file mode 100644 index 00000000..52d5e93f --- /dev/null +++ b/src/scintilla_backports/6168_d046ce80d590.patch @@ -0,0 +1,2631 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491476677 -36000 +# Node ID d046ce80d590607515c1ab59513101818e3da415 +# Parent 797ed6c538fdb3de395888cf46e847a617c48f60 +Added const where possible. + +diff -r 797ed6c538fd -r d046ce80d590 include/Platform.h +--- a/include/Platform.h Thu Apr 06 20:19:23 2017 +1000 ++++ b/include/Platform.h Thu Apr 06 21:04:37 2017 +1000 +@@ -136,7 +136,7 @@ + + // Other automatically defined methods (assignment, copy constructor, destructor) are fine + +- bool operator==(PRectangle &rc) const { ++ bool operator==(const PRectangle &rc) const { + return (rc.left == left) && (rc.right == right) && + (rc.top == top) && (rc.bottom == bottom); + } +diff -r 797ed6c538fd -r d046ce80d590 lexlib/Accessor.cxx +--- a/lexlib/Accessor.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/lexlib/Accessor.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -29,7 +29,7 @@ + } + + int Accessor::IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { +- Sci_Position end = Length(); ++ const Sci_Position end = Length(); + int spaceFlags = 0; + + // Determines the indentation level of the current line and also checks for consistent +@@ -44,7 +44,7 @@ + Sci_Position posPrev = inPrevPrefix ? LineStart(line-1) : 0; + while ((ch == ' ' || ch == '\t') && (pos < end)) { + if (inPrevPrefix) { +- char chPrev = (*this)[posPrev++]; ++ const char chPrev = (*this)[posPrev++]; + if (chPrev == ' ' || chPrev == '\t') { + if (chPrev != ch) + spaceFlags |= wsInconsistent; +diff -r 797ed6c538fd -r d046ce80d590 lexlib/CharacterCategory.cxx +--- a/lexlib/CharacterCategory.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/lexlib/CharacterCategory.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -3808,11 +3808,11 @@ + if (IsIdPattern(character)) { + return false; + } +- OtherID oid = OtherIDOfCharacter(character); ++ const OtherID oid = OtherIDOfCharacter(character); + if (oid == OtherID::oidStart) { + return true; + } +- CharacterCategory c = CategoriseCharacter(character); ++ const CharacterCategory c = CategoriseCharacter(character); + return (c == ccLl || c == ccLu || c == ccLt || c == ccLm || c == ccLo + || c == ccNl); + } +@@ -3823,11 +3823,11 @@ + if (IsIdPattern(character)) { + return false; + } +- OtherID oid = OtherIDOfCharacter(character); ++ const OtherID oid = OtherIDOfCharacter(character); + if (oid != OtherID::oidNone) { + return true; + } +- CharacterCategory c = CategoriseCharacter(character); ++ const CharacterCategory c = CategoriseCharacter(character); + return (c == ccLl || c == ccLu || c == ccLt || c == ccLm || c == ccLo + || c == ccNl || c == ccMn || c == ccMc || c == ccNd || c == ccPc); + } +diff -r 797ed6c538fd -r d046ce80d590 lexlib/CharacterSet.cxx +--- a/lexlib/CharacterSet.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/lexlib/CharacterSet.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -22,8 +22,8 @@ + int CompareCaseInsensitive(const char *a, const char *b) { + while (*a && *b) { + if (*a != *b) { +- char upperA = static_cast<char>(MakeUpperCase(*a)); +- char upperB = static_cast<char>(MakeUpperCase(*b)); ++ const char upperA = static_cast<char>(MakeUpperCase(*a)); ++ const char upperB = static_cast<char>(MakeUpperCase(*b)); + if (upperA != upperB) + return upperA - upperB; + } +@@ -37,8 +37,8 @@ + int CompareNCaseInsensitive(const char *a, const char *b, size_t len) { + while (*a && *b && len) { + if (*a != *b) { +- char upperA = static_cast<char>(MakeUpperCase(*a)); +- char upperB = static_cast<char>(MakeUpperCase(*b)); ++ const char upperA = static_cast<char>(MakeUpperCase(*a)); ++ const char upperB = static_cast<char>(MakeUpperCase(*b)); + if (upperA != upperB) + return upperA - upperB; + } +diff -r 797ed6c538fd -r d046ce80d590 lexlib/LexAccessor.h +--- a/lexlib/LexAccessor.h Thu Apr 06 20:19:23 2017 +1000 ++++ b/lexlib/LexAccessor.h Thu Apr 06 21:04:37 2017 +1000 +@@ -125,7 +125,7 @@ + } else { + // Old interface means only '\r', '\n' and '\r\n' line ends. + Sci_Position startNext = pAccess->LineStart(line+1); +- char chLineEnd = SafeGetCharAt(startNext-1); ++ const char chLineEnd = SafeGetCharAt(startNext-1); + if (chLineEnd == '\n' && (SafeGetCharAt(startNext-2) == '\r')) + return startNext - 2; + else +diff -r 797ed6c538fd -r d046ce80d590 lexlib/StyleContext.h +--- a/lexlib/StyleContext.h Thu Apr 06 20:19:23 2017 +1000 ++++ b/lexlib/StyleContext.h Thu Apr 06 21:04:37 2017 +1000 +@@ -130,7 +130,7 @@ + } + } + void ForwardBytes(Sci_Position nb) { +- Sci_PositionU forwardPos = currentPos + nb; ++ const Sci_PositionU forwardPos = currentPos + nb; + while (forwardPos > currentPos) { + Forward(); + } +@@ -165,7 +165,7 @@ + } + Sci_Position diffRelative = n - offsetRelative; + Sci_Position posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative); +- int chReturn = multiByteAccess->GetCharacterAndWidth(posNew, 0); ++ const int chReturn = multiByteAccess->GetCharacterAndWidth(posNew, 0); + posRelative = posNew; + currentPosLastRelative = currentPos; + offsetRelative = n; +diff -r 797ed6c538fd -r d046ce80d590 lexlib/WordList.cxx +--- a/lexlib/WordList.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/lexlib/WordList.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -34,7 +34,7 @@ + wordSeparator[static_cast<unsigned int>('\t')] = true; + } + for (int j = 0; wordlist[j]; j++) { +- int curr = static_cast<unsigned char>(wordlist[j]); ++ const int curr = static_cast<unsigned char>(wordlist[j]); + if (!wordSeparator[curr] && wordSeparator[prev]) + words++; + prev = curr; +@@ -143,7 +143,7 @@ + bool WordList::InList(const char *s) const { + if (0 == words) + return false; +- unsigned char firstChar = s[0]; ++ const unsigned char firstChar = s[0]; + int j = starts[firstChar]; + if (j >= 0) { + while (static_cast<unsigned char>(words[j][0]) == firstChar) { +@@ -185,7 +185,7 @@ + bool WordList::InListAbbreviated(const char *s, const char marker) const { + if (0 == words) + return false; +- unsigned char firstChar = s[0]; ++ const unsigned char firstChar = s[0]; + int j = starts[firstChar]; + if (j >= 0) { + while (static_cast<unsigned char>(words[j][0]) == firstChar) { +@@ -239,7 +239,7 @@ + bool WordList::InListAbridged(const char *s, const char marker) const { + if (0 == words) + return false; +- unsigned char firstChar = s[0]; ++ const unsigned char firstChar = s[0]; + int j = starts[firstChar]; + if (j >= 0) { + while (static_cast<unsigned char>(words[j][0]) == firstChar) { +diff -r 797ed6c538fd -r d046ce80d590 src/AutoComplete.cxx +--- a/src/AutoComplete.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/AutoComplete.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -131,9 +131,9 @@ + } + + bool operator()(int a, int b) { +- int lenA = indices[a * 2 + 1] - indices[a * 2]; +- int lenB = indices[b * 2 + 1] - indices[b * 2]; +- int len = std::min(lenA, lenB); ++ const int lenA = indices[a * 2 + 1] - indices[a * 2]; ++ const int lenB = indices[b * 2 + 1] - indices[b * 2]; ++ const int len = std::min(lenA, lenB); + int cmp; + if (ac->ignoreCase) + cmp = CompareNCaseInsensitive(list + indices[a * 2], list + indices[b * 2], len); +@@ -217,7 +217,7 @@ + + + void AutoComplete::Move(int delta) { +- int count = lb->Length(); ++ const int count = lb->Length(); + int current = lb->GetSelection(); + current += delta; + if (current >= count) +diff -r 797ed6c538fd -r d046ce80d590 src/CallTip.cxx +--- a/src/CallTip.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/CallTip.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -90,7 +90,7 @@ + int posStart, int posEnd, int ytext, PRectangle rcClient, + bool highlight, bool draw) { + s += posStart; +- int len = posEnd - posStart; ++ const int len = posEnd - posStart; + + // Divide the text into sections that are all text, or that are + // single arrows or single tab characters (if tabSize > 0). +@@ -113,7 +113,7 @@ + if (endSeg > startSeg) { + if (IsArrowCharacter(s[startSeg])) { + xEnd = x + widthArrow; +- bool upArrow = s[startSeg] == '\001'; ++ const bool upArrow = s[startSeg] == '\001'; + rcClient.left = static_cast<XYPOSITION>(x); + rcClient.right = static_cast<XYPOSITION>(xEnd); + if (draw) { +@@ -189,9 +189,9 @@ + chunkEnd = chunkVal + strlen(chunkVal); + moreChunks = false; + } +- int chunkOffset = static_cast<int>(chunkVal - val.c_str()); +- int chunkLength = static_cast<int>(chunkEnd - chunkVal); +- int chunkEndOffset = chunkOffset + chunkLength; ++ const int chunkOffset = static_cast<int>(chunkVal - val.c_str()); ++ const int chunkLength = static_cast<int>(chunkEnd - chunkVal); ++ const int chunkEndOffset = chunkOffset + chunkLength; + int thisStartHighlight = std::max(startHighlight, chunkOffset); + thisStartHighlight = std::min(thisStartHighlight, chunkEndOffset); + thisStartHighlight -= chunkOffset; +diff -r 797ed6c538fd -r d046ce80d590 src/CaseConvert.cxx +--- a/src/CaseConvert.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/CaseConvert.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -708,18 +708,18 @@ + void SetupConversions(enum CaseConversion conversion) { + // First initialize for the symmetric ranges + for (size_t i=0; i<ELEMENTS(symmetricCaseConversionRanges);) { +- int lower = symmetricCaseConversionRanges[i++]; +- int upper = symmetricCaseConversionRanges[i++]; +- int length = symmetricCaseConversionRanges[i++]; +- int pitch = symmetricCaseConversionRanges[i++]; ++ const int lower = symmetricCaseConversionRanges[i++]; ++ const int upper = symmetricCaseConversionRanges[i++]; ++ const int length = symmetricCaseConversionRanges[i++]; ++ const int pitch = symmetricCaseConversionRanges[i++]; + for (int j=0; j<length*pitch; j+=pitch) { + AddSymmetric(conversion, lower+j, upper+j); + } + } + // Add the symmetric singletons + for (size_t i=0; i<ELEMENTS(symmetricCaseConversions);) { +- int lower = symmetricCaseConversions[i++]; +- int upper = symmetricCaseConversions[i++]; ++ const int lower = symmetricCaseConversions[i++]; ++ const int upper = symmetricCaseConversions[i++]; + AddSymmetric(conversion, lower, upper); + } + // Add the complex cases +diff -r 797ed6c538fd -r d046ce80d590 src/CellBuffer.cxx +--- a/src/CellBuffer.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/CellBuffer.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -162,7 +162,7 @@ + // as two actions may be created by the calling function + if (currentAction >= (lenActions - 2)) { + // Run out of undo nodes so extend the array +- int lenActionsNew = lenActions * 2; ++ const int lenActionsNew = lenActions * 2; + Action *actionsNew = new Action[lenActionsNew]; + for (int act = 0; act <= currentAction; act++) + actionsNew[act].Grab(&actions[act]); +@@ -240,7 +240,7 @@ + currentAction++; + } + startSequence = oldCurrentAction != currentAction; +- int actionWithData = currentAction; ++ const int actionWithData = currentAction; + actions[currentAction].Create(at, position, data, lengthData, mayCoalesce); + currentAction++; + actions[currentAction].Create(startAction); +@@ -439,7 +439,7 @@ + } + + bool CellBuffer::SetStyleAt(Sci::Position position, char styleValue) { +- char curVal = style.ValueAt(position); ++ const char curVal = style.ValueAt(position); + if (curVal != styleValue) { + style.SetValueAt(position, styleValue); + return true; +@@ -453,7 +453,7 @@ + PLATFORM_ASSERT(lengthStyle == 0 || + (lengthStyle > 0 && lengthStyle + position <= style.Length())); + while (lengthStyle--) { +- char curVal = style.ValueAt(position); ++ const char curVal = style.ValueAt(position); + if (curVal != styleValue) { + style.SetValueAt(position, styleValue); + changed = true; +@@ -505,7 +505,7 @@ + if ((ch == '\r') || (ch == '\n')) { + return true; + } else if (utf8LineEnds) { +- unsigned char back3[3] = { chBeforePrev, chPrev, ch }; ++ const unsigned char back3[3] = { chBeforePrev, chPrev, ch }; + if (UTF8IsSeparator(back3) || UTF8IsNEL(back3 + 1)) { + return true; + } +@@ -576,7 +576,7 @@ + } + + bool CellBuffer::UTF8LineEndOverlaps(Sci::Position position) const { +- unsigned char bytes[] = { ++ const unsigned char bytes[] = { + static_cast<unsigned char>(substance.ValueAt(position-2)), + static_cast<unsigned char>(substance.ValueAt(position-1)), + static_cast<unsigned char>(substance.ValueAt(position)), +@@ -597,7 +597,7 @@ + unsigned char chBeforePrev = 0; + unsigned char chPrev = 0; + for (Sci::Position i = 0; i < length; i++) { +- unsigned char ch = substance.ValueAt(position + i); ++ const unsigned char ch = substance.ValueAt(position + i); + if (ch == '\r') { + InsertLine(lineInsert, (position + i) + 1, atLineStart); + lineInsert++; +@@ -610,7 +610,7 @@ + lineInsert++; + } + } else if (utf8LineEnds) { +- unsigned char back3[3] = {chBeforePrev, chPrev, ch}; ++ const unsigned char back3[3] = {chBeforePrev, chPrev, ch}; + if (UTF8IsSeparator(back3) || UTF8IsNEL(back3+1)) { + InsertLine(lineInsert, (position + i) + 1, atLineStart); + lineInsert++; +@@ -626,7 +626,7 @@ + return; + PLATFORM_ASSERT(insertLength > 0); + +- unsigned char chAfter = substance.ValueAt(position); ++ const unsigned char chAfter = substance.ValueAt(position); + bool breakingUTF8LineEnd = false; + if (utf8LineEnds && UTF8IsTrailByte(chAfter)) { + breakingUTF8LineEnd = UTF8LineEndOverlaps(position); +@@ -664,7 +664,7 @@ + lineInsert++; + } + } else if (utf8LineEnds) { +- unsigned char back3[3] = {chBeforePrev, chPrev, ch}; ++ const unsigned char back3[3] = {chBeforePrev, chPrev, ch}; + if (UTF8IsSeparator(back3) || UTF8IsNEL(back3+1)) { + InsertLine(lineInsert, (position + i) + 1, atLineStart); + lineInsert++; +@@ -682,8 +682,8 @@ + } else if (utf8LineEnds && !UTF8IsAscii(chAfter)) { + // May have end of UTF-8 line end in buffer and start in insertion + for (int j = 0; j < UTF8SeparatorLength-1; j++) { +- unsigned char chAt = substance.ValueAt(position + insertLength + j); +- unsigned char back3[3] = {chBeforePrev, chPrev, chAt}; ++ const unsigned char chAt = substance.ValueAt(position + insertLength + j); ++ const unsigned char back3[3] = {chBeforePrev, chPrev, chAt}; + if (UTF8IsSeparator(back3)) { + InsertLine(lineInsert, (position + insertLength + j) + 1, atLineStart); + lineInsert++; +@@ -712,8 +712,8 @@ + + Sci::Line lineRemove = lv.LineFromPosition(position) + 1; + lv.InsertText(lineRemove-1, - (deleteLength)); +- unsigned char chPrev = substance.ValueAt(position - 1); +- unsigned char chBefore = chPrev; ++ const unsigned char chPrev = substance.ValueAt(position - 1); ++ const unsigned char chBefore = chPrev; + unsigned char chNext = substance.ValueAt(position); + bool ignoreNL = false; + if (chPrev == '\r' && chNext == '\n') { +@@ -743,7 +743,7 @@ + } + } else if (utf8LineEnds) { + if (!UTF8IsAscii(ch)) { +- unsigned char next3[3] = {ch, chNext, ++ const unsigned char next3[3] = {ch, chNext, + static_cast<unsigned char>(substance.ValueAt(position + i + 2))}; + if (UTF8IsSeparator(next3) || UTF8IsNEL(next3)) { + RemoveLine(lineRemove); +@@ -755,7 +755,7 @@ + } + // May have to fix up end if last deletion causes cr to be next to lf + // or removes one of a crlf pair +- char chAfter = substance.ValueAt(position + deleteLength); ++ const char chAfter = substance.ValueAt(position + deleteLength); + if (chBefore == '\r' && chAfter == '\n') { + // Using lineRemove-1 as cr ended line before start of deletion + RemoveLine(lineRemove - 1); +diff -r 797ed6c538fd -r d046ce80d590 src/Decoration.cxx +--- a/src/Decoration.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/Decoration.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -125,7 +125,7 @@ + current = Create(currentIndicator, lengthDocument); + } + } +- bool changed = current->rs.FillRange(position, value, fillLength); ++ const bool changed = current->rs.FillRange(position, value, fillLength); + if (current->Empty()) { + Delete(currentIndicator); + } +@@ -177,7 +177,7 @@ + } + + int DecorationList::ValueAt(int indicator, int position) { +- Decoration *deco = DecorationFromIndicator(indicator); ++ const Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.ValueAt(position); + } +@@ -185,7 +185,7 @@ + } + + int DecorationList::Start(int indicator, int position) { +- Decoration *deco = DecorationFromIndicator(indicator); ++ const Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.StartRun(position); + } +@@ -193,7 +193,7 @@ + } + + int DecorationList::End(int indicator, int position) { +- Decoration *deco = DecorationFromIndicator(indicator); ++ const Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.EndRun(position); + } +diff -r 797ed6c538fd -r d046ce80d590 src/Document.cxx +--- a/src/Document.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/Document.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -84,7 +84,7 @@ + + int LexInterface::LineEndTypesSupported() { + if (instance) { +- int interfaceVersion = instance->Version(); ++ const int interfaceVersion = instance->Version(); + if (interfaceVersion >= lvSubStyles) { + ILexerWithSubStyles *ssinstance = static_cast<ILexerWithSubStyles *>(instance); + return ssinstance->LineEndTypesSupported(); +@@ -211,7 +211,7 @@ + // Decrease reference count and return its previous value. + // Delete the document if reference count reaches zero. + int SCI_METHOD Document::Release() { +- int curRefCount = --refCount; ++ const int curRefCount = --refCount; + if (curRefCount == 0) + delete this; + return curRefCount; +@@ -229,9 +229,9 @@ + if (enteredModification == 0) { + enteredModification++; + if (!cb.IsReadOnly()) { +- bool startSavePoint = cb.IsSavePoint(); ++ const bool startSavePoint = cb.IsSavePoint(); + bool multiLine = false; +- int steps = cb.TentativeSteps(); ++ const int steps = cb.TentativeSteps(); + //Platform::DebugPrintf("Steps=%d\n", steps); + for (int step = 0; step < steps; step++) { + const Sci::Line prevLinesTotal = LinesTotal(); +@@ -293,7 +293,7 @@ + + int Document::AddMark(Sci::Line line, int markerNum) { + if (line >= 0 && line <= LinesTotal()) { +- int prev = static_cast<LineMarkers *>(perLineData[ldMarkers])-> ++ const int prev = static_cast<LineMarkers *>(perLineData[ldMarkers])-> + AddMark(line, markerNum, LinesTotal()); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +@@ -360,7 +360,7 @@ + } else { + Sci::Position position = LineStart(line + 1); + if (SC_CP_UTF8 == dbcsCodePage) { +- unsigned char bytes[] = { ++ const unsigned char bytes[] = { + static_cast<unsigned char>(cb.CharAt(position-3)), + static_cast<unsigned char>(cb.CharAt(position-2)), + static_cast<unsigned char>(cb.CharAt(position-1)), +@@ -407,7 +407,7 @@ + Sci::Position Document::VCHomePosition(Sci::Position position) const { + Sci::Line line = LineFromPosition(position); + Sci::Position startPosition = LineStart(line); +- Sci::Position endLine = LineEnd(line); ++ const Sci::Position endLine = LineEnd(line); + Sci::Position startText = startPosition; + while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t')) + startText++; +@@ -418,7 +418,7 @@ + } + + int SCI_METHOD Document::SetLevel(Sci_Position line, int level) { +- int prev = static_cast<LineLevels *>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); ++ const int prev = static_cast<LineLevels *>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); + if (prev != level) { + DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, + LineStart(line), 0, 0, 0, line); +@@ -447,8 +447,8 @@ + Sci::Line Document::GetLastChild(Sci::Line lineParent, int level, Sci::Line lastLine) { + if (level == -1) + level = LevelNumber(GetLevel(lineParent)); +- Sci::Line maxLine = LinesTotal(); +- Sci::Line lookLastLine = (lastLine != -1) ? std::min(LinesTotal() - 1, lastLine) : -1; ++ const Sci::Line maxLine = LinesTotal(); ++ const Sci::Line lookLastLine = (lastLine != -1) ? std::min(LinesTotal() - 1, lastLine) : -1; + Sci::Line lineMaxSubord = lineParent; + while (lineMaxSubord < maxLine - 1) { + EnsureStyledTo(LineStart(lineMaxSubord + 2)); +@@ -470,7 +470,7 @@ + } + + Sci::Line Document::GetFoldParent(Sci::Line line) const { +- int level = LevelNumber(GetLevel(line)); ++ const int level = LevelNumber(GetLevel(line)); + Sci::Line lineLook = line - 1; + while ((lineLook > 0) && ( + (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || +@@ -487,7 +487,7 @@ + } + + void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, Sci::Line line, Sci::Line lastLine) { +- int level = GetLevel(line); ++ const int level = GetLevel(line); + Sci::Line lookLastLine = std::max(line, lastLine) + 1; + + Sci::Line lookLine = line; +@@ -599,15 +599,15 @@ + if (widthCharBytes == 1) { + return false; + } else { +- int trailBytes = widthCharBytes - 1; +- Sci::Position len = pos - start; ++ const int trailBytes = widthCharBytes - 1; ++ const Sci::Position len = pos - start; + if (len > trailBytes) + // pos too far from lead + return false; + char charBytes[UTF8MaxBytes] = {static_cast<char>(leadByte),0,0,0}; + for (int b=1; b<widthCharBytes && ((start+b) < Length()); b++) + charBytes[b] = cb.CharAt(static_cast<Sci::Position>(start+b)); +- int utf8status = UTF8Classify(reinterpret_cast<const unsigned char *>(charBytes), widthCharBytes); ++ const int utf8status = UTF8Classify(reinterpret_cast<const unsigned char *>(charBytes), widthCharBytes); + if (utf8status & UTF8MaskInvalid) + return false; + end = start + widthCharBytes; +@@ -638,7 +638,7 @@ + + if (dbcsCodePage) { + if (SC_CP_UTF8 == dbcsCodePage) { +- unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); ++ const unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); + // If ch is not a trail byte then pos is valid intercharacter position + if (UTF8IsTrailByte(ch)) { + Sci::Position startUTF = pos; +@@ -655,7 +655,7 @@ + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. +- Sci::Position posStartLine = LineStart(LineFromPosition(pos)); ++ const Sci::Position posStartLine = LineStart(LineFromPosition(pos)); + if (pos == posStartLine) + return pos; + +@@ -717,7 +717,7 @@ + } else { + // Examine byte before position + pos--; +- unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); ++ const unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); + // If ch is not a trail byte then pos is valid intercharacter position + if (UTF8IsTrailByte(ch)) { + // If ch is a trail byte in a valid UTF-8 character then return start of character +@@ -738,7 +738,7 @@ + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. +- Sci::Position posStartLine = LineStart(LineFromPosition(pos)); ++ const Sci::Position posStartLine = LineStart(LineFromPosition(pos)); + // See http://msdn.microsoft.com/en-us/library/cc194792%28v=MSDN.10%29.aspx + // http://msdn.microsoft.com/en-us/library/cc194790.aspx + if ((pos - 1) <= posStartLine) { +@@ -902,7 +902,7 @@ + unsigned char charBytes[UTF8MaxBytes] = {leadByte,0,0,0}; + for (int b=1; b<widthCharBytes; b++) + charBytes[b] = static_cast<unsigned char>(cb.CharAt(position+b)); +- int utf8status = UTF8Classify(charBytes, widthCharBytes); ++ const int utf8status = UTF8Classify(charBytes, widthCharBytes); + if (utf8status & UTF8MaskInvalid) { + // Report as singleton surrogate values which are invalid Unicode + character = 0xDC80 + leadByte; +@@ -934,7 +934,7 @@ + + bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const { + // Byte ranges found in Wikipedia articles with relevant search strings in each case +- unsigned char uch = static_cast<unsigned char>(ch); ++ const unsigned char uch = static_cast<unsigned char>(ch); + switch (dbcsCodePage) { + case 932: + // Shift_jis +@@ -982,7 +982,7 @@ + int lastPunctuationBreak = -1; + int lastEncodingAllowedBreak = 0; + for (int j=0; j < lengthSegment;) { +- unsigned char ch = static_cast<unsigned char>(text[j]); ++ const unsigned char ch = static_cast<unsigned char>(text[j]); + if (j > 0) { + if (IsSpaceOrTab(text[j - 1]) && !IsSpaceOrTab(text[j])) { + lastSpaceBreak = j; +@@ -1150,9 +1150,9 @@ + if ((enteredModification == 0) && (cb.IsCollectingUndo())) { + enteredModification++; + if (!cb.IsReadOnly()) { +- bool startSavePoint = cb.IsSavePoint(); ++ const bool startSavePoint = cb.IsSavePoint(); + bool multiLine = false; +- int steps = cb.StartUndo(); ++ const int steps = cb.StartUndo(); + //Platform::DebugPrintf("Steps=%d\n", steps); + Sci::Position coalescedRemovePos = -1; + Sci::Position coalescedRemoveLen = 0; +@@ -1235,9 +1235,9 @@ + if ((enteredModification == 0) && (cb.IsCollectingUndo())) { + enteredModification++; + if (!cb.IsReadOnly()) { +- bool startSavePoint = cb.IsSavePoint(); ++ const bool startSavePoint = cb.IsSavePoint(); + bool multiLine = false; +- int steps = cb.StartRedo(); ++ const int steps = cb.StartRedo(); + for (int step = 0; step < steps; step++) { + const Sci::Line prevLinesTotal = LinesTotal(); + const Action &action = cb.GetRedoStep(); +@@ -1328,10 +1328,10 @@ + int SCI_METHOD Document::GetLineIndentation(Sci_Position line) { + int indent = 0; + if ((line >= 0) && (line < LinesTotal())) { +- Sci::Position lineStart = LineStart(line); +- Sci::Position length = Length(); ++ const Sci::Position lineStart = LineStart(line); ++ const Sci::Position length = Length(); + for (Sci::Position i = lineStart; i < length; i++) { +- char ch = cb.CharAt(i); ++ const char ch = cb.CharAt(i); + if (ch == ' ') + indent++; + else if (ch == '\t') +@@ -1344,7 +1344,7 @@ + } + + Sci::Position Document::SetLineIndentation(Sci::Line line, Sci::Position indent) { +- int indentOfLine = GetLineIndentation(line); ++ const int indentOfLine = GetLineIndentation(line); + if (indent < 0) + indent = 0; + if (indent != indentOfLine) { +@@ -1364,7 +1364,7 @@ + if (line < 0) + return 0; + Sci::Position pos = LineStart(line); +- Sci::Position length = Length(); ++ const Sci::Position length = Length(); + while ((pos < length) && IsSpaceOrTab(cb.CharAt(pos))) { + pos++; + } +@@ -1376,7 +1376,7 @@ + Sci::Line line = LineFromPosition(pos); + if ((line >= 0) && (line < LinesTotal())) { + for (Sci::Position i = LineStart(line); i < pos;) { +- char ch = cb.CharAt(i); ++ const char ch = cb.CharAt(i); + if (ch == '\t') { + column = NextTab(column, tabInChars); + i++; +@@ -1427,7 +1427,7 @@ + if ((line >= 0) && (line < LinesTotal())) { + Sci::Position columnCurrent = 0; + while ((columnCurrent < column) && (position < Length())) { +- char ch = cb.CharAt(position); ++ const char ch = cb.CharAt(position); + if (ch == '\t') { + columnCurrent = NextTab(columnCurrent, tabInChars); + if (columnCurrent > column) +@@ -1524,7 +1524,7 @@ + + bool Document::IsWhiteLine(Sci::Line line) const { + Sci::Position currentChar = LineStart(line); +- Sci::Position endLine = LineEnd(line); ++ const Sci::Position endLine = LineEnd(line); + while (currentChar < endLine) { + if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') { + return false; +@@ -1718,7 +1718,7 @@ + if (delta < 0) { + if (pos > 0) { + CharacterExtracted ce = CharacterBefore(pos); +- CharClassify::cc ccStart = WordCharacterClass(ce.character); ++ const CharClassify::cc ccStart = WordCharacterClass(ce.character); + if (ccStart != CharClassify::ccSpace) { + while (pos > 0) { + ce = CharacterBefore(pos); +@@ -1743,7 +1743,7 @@ + } + if (pos < Length()) { + CharacterExtracted ce = CharacterAfter(pos); +- CharClassify::cc ccStart = WordCharacterClass(ce.character); ++ const CharClassify::cc ccStart = WordCharacterClass(ce.character); + while (pos < Length()) { + ce = CharacterAfter(pos); + if (WordCharacterClass(ce.character) != ccStart) +@@ -2125,7 +2125,7 @@ + } + + int SCI_METHOD Document::SetLineState(Sci_Position line, int state) { +- int statePrevious = static_cast<LineState *>(perLineData[ldState])->SetLineState(line, state); ++ const int statePrevious = static_cast<LineState *>(perLineData[ldState])->SetLineState(line, state); + if (state != statePrevious) { + DocModification mh(SC_MOD_CHANGELINESTATE, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +@@ -2147,7 +2147,7 @@ + } + + StyledText Document::MarginStyledText(Sci::Line line) const { +- LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldMargin]); ++ const LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldMargin]); + return StyledText(pla->Length(line), pla->Text(line), + pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); + } +@@ -2169,7 +2169,7 @@ + } + + void Document::MarginClearAll() { +- Sci::Line maxEditorLine = LinesTotal(); ++ const Sci::Line maxEditorLine = LinesTotal(); + for (Sci::Line l=0; l<maxEditorLine; l++) + MarginSetText(l, 0); + // Free remaining data +@@ -2177,7 +2177,7 @@ + } + + StyledText Document::AnnotationStyledText(Sci::Line line) const { +- LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldAnnotation]); ++ const LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldAnnotation]); + return StyledText(pla->Length(line), pla->Text(line), + pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); + } +@@ -2210,7 +2210,7 @@ + } + + void Document::AnnotationClearAll() { +- Sci::Line maxEditorLine = LinesTotal(); ++ const Sci::Line maxEditorLine = LinesTotal(); + for (Sci::Line l=0; l<maxEditorLine; l++) + AnnotationSetText(l, 0); + // Free remaining data +@@ -2416,7 +2416,7 @@ + } + + Sci::Position Document::ExtendStyleRange(Sci::Position pos, int delta, bool singleLine) { +- int sStart = cb.StyleAt(pos); ++ const int sStart = cb.StyleAt(pos); + if (delta < 0) { + while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) + pos--; +@@ -2453,8 +2453,8 @@ + + // TODO: should be able to extend styled region to find matching brace + Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxReStyle*/) { +- char chBrace = CharAt(position); +- char chSeek = BraceOpposite(chBrace); ++ const char chBrace = CharAt(position); ++ const char chSeek = BraceOpposite(chBrace); + if (chSeek == '\0') + return - 1; + const int styBrace = StyleIndexAt(position); +@@ -2464,7 +2464,7 @@ + int depth = 1; + position = NextPosition(position, direction); + while ((position >= 0) && (position < Length())) { +- char chAtPos = CharAt(position); ++ const char chAtPos = CharAt(position); + const int styAtPos = StyleIndexAt(position); + if ((position > GetEndStyled()) || (styAtPos == styBrace)) { + if (chAtPos == chBrace) +@@ -2474,7 +2474,7 @@ + if (depth == 0) + return position; + } +- Sci::Position positionBeforeMove = position; ++ const Sci::Position positionBeforeMove = position; + position = NextPosition(position, direction); + if (position == positionBeforeMove) + break; +@@ -2740,7 +2740,7 @@ + } + private: + void ReadCharacter() { +- Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position); ++ const Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position); + lenBytes = charExtracted.widthBytes; + if (charExtracted.character == unicodeReplacementChar) { + lenCharacters = 1; +diff -r 797ed6c538fd -r d046ce80d590 src/EditView.cxx +--- a/src/EditView.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/EditView.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -244,7 +244,7 @@ + } + + int EditView::GetNextTabstop(Sci::Line line, int x) const { +- LineTabstops *lt = static_cast<LineTabstops *>(ldTabstops); ++ const LineTabstops *lt = static_cast<LineTabstops *>(ldTabstops); + if (lt) { + return lt->GetNextTabstop(line, x); + } else { +@@ -386,7 +386,7 @@ + int numCharsInLine = 0; + while (numCharsInLine < lineLength) { + Sci::Position charInDoc = numCharsInLine + posLineStart; +- char chDoc = model.pdoc->CharAt(charInDoc); ++ const char chDoc = model.pdoc->CharAt(charInDoc); + styleByte = model.pdoc->StyleIndexAt(charInDoc); + allSame = allSame && + (ll->styles[numCharsInLine] == styleByte); +@@ -435,7 +435,7 @@ + const int lineLength = posLineEnd - posLineStart; + model.pdoc->GetCharRange(ll->chars, posLineStart, lineLength); + model.pdoc->GetStyleRange(ll->styles, posLineStart, lineLength); +- int numCharsBeforeEOL = model.pdoc->LineEnd(line) - posLineStart; ++ const int numCharsBeforeEOL = model.pdoc->LineEnd(line) - posLineStart; + const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL; + for (Sci::Position styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) { + const unsigned char styleByte = ll->styles[styleInLine]; +@@ -444,7 +444,7 @@ + const unsigned char styleByteLast = (lineLength > 0) ? ll->styles[lineLength - 1] : 0; + if (vstyle.someStylesForceCase) { + for (int charInLine = 0; charInLine<lineLength; charInLine++) { +- char chDoc = ll->chars[charInLine]; ++ const char chDoc = ll->chars[charInLine]; + if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseUpper) + ll->chars[charInLine] = static_cast<char>(MakeUpperCase(chDoc)); + else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower) +@@ -721,13 +721,13 @@ + } + + Sci::Line EditView::DisplayFromPosition(Surface *surface, const EditModel &model, Sci::Position pos, const ViewStyle &vs) { +- Sci::Line lineDoc = model.pdoc->LineFromPosition(pos); ++ const Sci::Line lineDoc = model.pdoc->LineFromPosition(pos); + Sci::Line lineDisplay = model.cs.DisplayFromDoc(lineDoc); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); + if (surface && ll) { + LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); +- Sci::Position posLineStart = model.pdoc->LineStart(lineDoc); +- Sci::Position posInLine = pos - posLineStart; ++ const Sci::Position posLineStart = model.pdoc->LineStart(lineDoc); ++ const Sci::Position posInLine = pos - posLineStart; + lineDisplay--; // To make up for first increment ahead. + for (int subLine = 0; subLine < ll->lines; subLine++) { + if (posInLine >= ll->LineStart(subLine)) { +@@ -739,13 +739,13 @@ + } + + Sci::Position EditView::StartEndDisplayLine(Surface *surface, const EditModel &model, Sci::Position pos, bool start, const ViewStyle &vs) { +- Sci::Line line = model.pdoc->LineFromPosition(pos); ++ const Sci::Line line = model.pdoc->LineFromPosition(pos); + AutoLineLayout ll(llc, RetrieveLineLayout(line, model)); + Sci::Position posRet = INVALID_POSITION; + if (surface && ll) { +- Sci::Position posLineStart = model.pdoc->LineStart(line); ++ const Sci::Position posLineStart = model.pdoc->LineStart(line); + LayoutLine(model, line, surface, vs, ll, model.wrapWidth); +- Sci::Position posInLine = pos - posLineStart; ++ const Sci::Position posInLine = pos - posLineStart; + if (posInLine <= ll->maxLineLength) { + for (int subLine = 0; subLine < ll->lines; subLine++) { + if ((posInLine >= ll->LineStart(subLine)) && +@@ -880,7 +880,7 @@ + const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; + virtualSpace = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)) * spaceWidth; + } +- XYPOSITION xEol = static_cast<XYPOSITION>(ll->positions[lineEnd] - subLineStart); ++ const XYPOSITION xEol = static_cast<XYPOSITION>(ll->positions[lineEnd] - subLineStart); + + // Fill the virtual space and show selections within it + if (virtualSpace > 0.0f) { +@@ -890,9 +890,9 @@ + if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) { + SelectionSegment virtualSpaceRange(SelectionPosition(model.pdoc->LineEnd(line)), SelectionPosition(model.pdoc->LineEnd(line), model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)))); + for (size_t r = 0; r<model.sel.Count(); r++) { +- int alpha = (r == model.sel.Main()) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; ++ const int alpha = (r == model.sel.Main()) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; + if (alpha == SC_ALPHA_NOALPHA) { +- SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange); ++ const SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange); + if (!portion.Empty()) { + const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; + rcSegment.left = xStart + ll->positions[portion.start.Position() - posLineStart] - +@@ -925,7 +925,7 @@ + blobsWidth += rcSegment.Width(); + char hexits[4]; + const char *ctrlChar; +- unsigned char chEOL = ll->chars[eolPos]; ++ const unsigned char chEOL = ll->chars[eolPos]; + int styleMain = ll->styles[eolPos]; + ColourDesired textBack = TextBackground(model, vsDraw, ll, background, eolInSelection, false, styleMain, eolPos); + if (UTF8IsAscii(chEOL)) { +@@ -986,7 +986,7 @@ + rcSegment.left = rcLine.left; + rcSegment.right = rcLine.right; + +- bool fillRemainder = !lastSubLine || model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_HIDDEN || !model.cs.GetFoldDisplayTextShown(line); ++ const bool fillRemainder = !lastSubLine || model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_HIDDEN || !model.cs.GetFoldDisplayTextShown(line); + if (fillRemainder) { + // Fill the remainder of the line + FillLineRemainder(surface, model, vsDraw, ll, line, rcSegment, subLine); +@@ -1064,7 +1064,7 @@ + const bool hover = vsDraw.indicators[deco->Indicator()].IsDynamic() && + rangeRun.ContainsCharacter(hoverIndicatorPos); + const int value = deco->rs.ValueAt(startPos); +- Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal; ++ const Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal; + const Sci::Position posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1); + DrawIndicator(deco->Indicator(), startPos - posLineStart, endPos - posLineStart, + surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, drawState, value); +@@ -1079,7 +1079,7 @@ + // Use indicators to highlight matching braces + if ((vsDraw.braceHighlightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACELIGHT)) || + (vsDraw.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD))) { +- int braceIndicator = (model.bracesMatchStyle == STYLE_BRACELIGHT) ? vsDraw.braceHighlightIndicator : vsDraw.braceBadLightIndicator; ++ const int braceIndicator = (model.bracesMatchStyle == STYLE_BRACELIGHT) ? vsDraw.braceHighlightIndicator : vsDraw.braceBadLightIndicator; + if (under == vsDraw.indicators[braceIndicator].under) { + Range rangeLine(posLineStart + lineStart, posLineEnd); + if (rangeLine.ContainsCharacter(model.braces[0])) { +@@ -1128,13 +1128,13 @@ + rcSegment.left = xStart + static_cast<XYPOSITION>(ll->positions[ll->numCharsInLine] - subLineStart) + virtualSpace + vsDraw.aveCharWidth; + rcSegment.right = rcSegment.left + static_cast<XYPOSITION>(widthFoldDisplayText); + +- ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); ++ const ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); + FontAlias textFont = vsDraw.styles[STYLE_FOLDDISPLAYTEXT].font; + ColourDesired textFore = vsDraw.styles[STYLE_FOLDDISPLAYTEXT].fore; + if (eolInSelection && (vsDraw.selColours.fore.isSet)) { + textFore = (eolInSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground; + } +- ColourDesired textBack = TextBackground(model, vsDraw, ll, background, eolInSelection, ++ const ColourDesired textBack = TextBackground(model, vsDraw, ll, background, eolInSelection, + false, STYLE_FOLDDISPLAYTEXT, -1); + + if (model.trackLineWidth) { +@@ -1198,9 +1198,9 @@ + + void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + Sci::Line line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { +- int indent = static_cast<int>(model.pdoc->GetLineIndentation(line) * vsDraw.spaceWidth); ++ const int indent = static_cast<int>(model.pdoc->GetLineIndentation(line) * vsDraw.spaceWidth); + PRectangle rcSegment = rcLine; +- int annotationLine = subLine - ll->lines; ++ const int annotationLine = subLine - ll->lines; + const StyledText stAnnotation = model.pdoc->AnnotationStyledText(line); + if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) { + if (phase & drawBack) { +@@ -1322,7 +1322,7 @@ + void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + Sci::Line lineDoc, int xStart, PRectangle rcLine, int subLine) const { + // When drag is active it is the only caret drawn +- bool drawDrag = model.posDrag.IsValid(); ++ const bool drawDrag = model.posDrag.IsValid(); + if (hideSelection && !drawDrag) + return; + const Sci::Position posLineStart = model.pdoc->LineStart(lineDoc); +@@ -1342,12 +1342,12 @@ + if (ll->InLine(offset, subLine) && offset <= ll->numCharsBeforeEOL) { + XYPOSITION xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)]; + if (ll->wrapIndent != 0) { +- Sci::Position lineStart = ll->LineStart(subLine); ++ const Sci::Position lineStart = ll->LineStart(subLine); + if (lineStart != 0) // Wrapped + xposCaret += ll->wrapIndent; + } +- bool caretBlinkState = (model.caret.active && model.caret.on) || (!additionalCaretsBlink && !mainCaret); +- bool caretVisibleState = additionalCaretsVisible || mainCaret; ++ const bool caretBlinkState = (model.caret.active && model.caret.on) || (!additionalCaretsBlink && !mainCaret); ++ const bool caretVisibleState = additionalCaretsVisible || mainCaret; + if ((xposCaret >= 0) && (vsDraw.caretWidth > 0) && (vsDraw.caretStyle != CARETSTYLE_INVISIBLE) && + ((model.posDrag.IsValid()) || (caretBlinkState && caretVisibleState))) { + bool caretAtEOF = false; +@@ -1566,13 +1566,13 @@ + if (subLine == (ll->lines - 1)) { + virtualSpaces = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)); + } +- SelectionPosition posStart(posLineStart + lineRange.start); +- SelectionPosition posEnd(posLineStart + lineRange.end, virtualSpaces); +- SelectionSegment virtualSpaceRange(posStart, posEnd); ++ const SelectionPosition posStart(posLineStart + lineRange.start); ++ const SelectionPosition posEnd(posLineStart + lineRange.end, virtualSpaces); ++ const SelectionSegment virtualSpaceRange(posStart, posEnd); + for (size_t r = 0; r < model.sel.Count(); r++) { +- int alpha = (r == model.sel.Main()) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; ++ const int alpha = (r == model.sel.Main()) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; + if (alpha != SC_ALPHA_NOALPHA) { +- SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange); ++ const SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange); + if (!portion.Empty()) { + const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; + PRectangle rcSegment = rcLine; +@@ -1838,7 +1838,7 @@ + xStartText = 100000; // Don't limit to visible indentation on empty line + // This line is empty, so use indentation of last line with text + int indentLastWithText = model.pdoc->GetLineIndentation(lineLastWithText); +- int isFoldHeader = model.pdoc->GetLevel(lineLastWithText) & SC_FOLDLEVELHEADERFLAG; ++ const int isFoldHeader = model.pdoc->GetLevel(lineLastWithText) & SC_FOLDLEVELHEADERFLAG; + if (isFoldHeader) { + // Level is one more level than parent + indentLastWithText += model.pdoc->IndentSize(); +@@ -1950,7 +1950,7 @@ + } + + static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, Sci::Line line, PRectangle rcLine) { +- bool expanded = model.cs.GetExpanded(line); ++ const bool expanded = model.cs.GetExpanded(line); + const int level = model.pdoc->GetLevel(line); + const int levelNext = model.pdoc->GetLevel(line + 1); + if ((level & SC_FOLDLEVELHEADERFLAG) && +@@ -2163,7 +2163,7 @@ + alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; + } + +- ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); ++ const ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); + + if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) { + surface->FillRectangle(rcArea, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)); +@@ -2188,8 +2188,8 @@ + unsigned int r = orig.GetRed(); + unsigned int g = orig.GetGreen(); + unsigned int b = orig.GetBlue(); +- unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye +- unsigned int il = 0xff - l; ++ const unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye ++ const unsigned int il = 0xff - l; + if (l == 0) + return ColourDesired(0xff, 0xff, 0xff); + r = r * il / l; +@@ -2320,7 +2320,7 @@ + // to start printing from to ensure a particular position is on the first + // line of the page. + if (visibleLine == 0) { +- Sci::Position startWithinLine = nPrintPos - model.pdoc->LineStart(lineDoc); ++ const Sci::Position startWithinLine = nPrintPos - model.pdoc->LineStart(lineDoc); + for (int iwl = 0; iwl < ll.lines - 1; iwl++) { + if (ll.LineStart(iwl) <= startWithinLine && ll.LineStart(iwl + 1) >= startWithinLine) { + visibleLine = -iwl; +diff -r 797ed6c538fd -r d046ce80d590 src/Editor.cxx +--- a/src/Editor.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/Editor.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -287,7 +287,7 @@ + PointDocument Editor::DocumentPointFromView(Point ptView) const { + PointDocument ptDocument(ptView); + if (wMargin.GetID()) { +- Point ptOrigin = GetVisibleOriginInMain(); ++ const Point ptOrigin = GetVisibleOriginInMain(); + ptDocument.x += ptOrigin.x; + ptDocument.y += ptOrigin.y; + } else { +@@ -321,8 +321,8 @@ + } + + Sci::Line Editor::LinesOnScreen() const { +- PRectangle rcClient = GetClientRectangle(); +- int htClient = static_cast<int>(rcClient.bottom - rcClient.top); ++ const PRectangle rcClient = GetClientRectangle(); ++ const int htClient = static_cast<int>(rcClient.bottom - rcClient.top); + //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1); + return htClient / vs.lineHeight; + } +@@ -565,14 +565,14 @@ + + void Editor::SetRectangularRange() { + if (sel.IsRectangular()) { +- int xAnchor = XFromPosition(sel.Rectangular().anchor); ++ const int xAnchor = XFromPosition(sel.Rectangular().anchor); + int xCaret = XFromPosition(sel.Rectangular().caret); + if (sel.selType == Selection::selThin) { + xCaret = xAnchor; + } +- Sci::Line lineAnchorRect = pdoc->LineFromPosition(sel.Rectangular().anchor.Position()); +- Sci::Line lineCaret = pdoc->LineFromPosition(sel.Rectangular().caret.Position()); +- int increment = (lineCaret > lineAnchorRect) ? 1 : -1; ++ const Sci::Line lineAnchorRect = pdoc->LineFromPosition(sel.Rectangular().anchor.Position()); ++ const Sci::Line lineCaret = pdoc->LineFromPosition(sel.Rectangular().caret.Position()); ++ const int increment = (lineCaret > lineAnchorRect) ? 1 : -1; + for (Sci::Line line=lineAnchorRect; line != lineCaret+increment; line += increment) { + SelectionRange range(SPositionFromLineX(line, xCaret), SPositionFromLineX(line, xAnchor)); + if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) == 0) +@@ -913,12 +913,12 @@ + } + + void Editor::ScrollTo(Sci::Line line, bool moveThumb) { +- Sci::Line topLineNew = Platform::Clamp(line, 0, MaxScrollPos()); ++ const Sci::Line topLineNew = Platform::Clamp(line, 0, MaxScrollPos()); + if (topLineNew != topLine) { + // Try to optimise small scrolls + #ifndef UNDER_CE +- Sci::Line linesToMove = topLine - topLineNew; +- bool performBlit = (abs(linesToMove) <= 10) && (paintState == notPainting); ++ const Sci::Line linesToMove = topLine - topLineNew; ++ const bool performBlit = (abs(linesToMove) <= 10) && (paintState == notPainting); + willRedrawAll = !performBlit; + #endif + SetTopLine(topLineNew); +@@ -960,9 +960,9 @@ + } + + void Editor::VerticalCentreCaret() { +- Sci::Line lineDoc = pdoc->LineFromPosition(sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret()); +- Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); +- Sci::Line newTop = lineDisplay - (LinesOnScreen() / 2); ++ const Sci::Line lineDoc = pdoc->LineFromPosition(sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret()); ++ const Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); ++ const Sci::Line newTop = lineDisplay - (LinesOnScreen() / 2); + if (topLine != newTop) { + SetTopLine(newTop > 0 ? newTop : 0); + RedrawRect(GetClientRectangle()); +@@ -979,15 +979,15 @@ + + // if selection doesn't start at the beginning of the line, set the new start + Sci::Position selectionStart = SelectionStart().Position(); +- Sci::Line startLine = pdoc->LineFromPosition(selectionStart); +- Sci::Position beginningOfStartLine = pdoc->LineStart(startLine); ++ const Sci::Line startLine = pdoc->LineFromPosition(selectionStart); ++ const Sci::Position beginningOfStartLine = pdoc->LineStart(startLine); + selectionStart = beginningOfStartLine; + + // if selection doesn't end at the beginning of a line greater than that of the start, + // then set it at the beginning of the next one + Sci::Position selectionEnd = SelectionEnd().Position(); +- Sci::Line endLine = pdoc->LineFromPosition(selectionEnd); +- Sci::Position beginningOfEndLine = pdoc->LineStart(endLine); ++ const Sci::Line endLine = pdoc->LineFromPosition(selectionEnd); ++ const Sci::Position beginningOfEndLine = pdoc->LineStart(endLine); + bool appendEol = false; + if (selectionEnd > beginningOfEndLine + || selectionStart == selectionEnd) { +@@ -1114,7 +1114,7 @@ + */ + + Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &range, const XYScrollOptions options) { +- PRectangle rcClient = GetTextRectangle(); ++ const PRectangle rcClient = GetTextRectangle(); + Point pt = LocationFromPosition(range.caret); + Point ptAnchor = LocationFromPosition(range.anchor); + const Point ptOrigin = GetVisibleOriginInMain(); +@@ -1334,14 +1334,14 @@ + if (!(range.caret == range.anchor)) { + if (ptAnchor.x < pt.x) { + // Shift to left to show anchor or as much of range as possible +- int maxOffset = static_cast<int>(ptAnchor.x + xOffset - rcClient.left) - 1; +- int minOffset = static_cast<int>(pt.x + xOffset - rcClient.right) + 1; ++ const int maxOffset = static_cast<int>(ptAnchor.x + xOffset - rcClient.left) - 1; ++ const int minOffset = static_cast<int>(pt.x + xOffset - rcClient.right) + 1; + newXY.xOffset = std::min(newXY.xOffset, maxOffset); + newXY.xOffset = std::max(newXY.xOffset, minOffset); + } else { + // Shift to right to show anchor or as much of range as possible +- int minOffset = static_cast<Sci::Position>(ptAnchor.x + xOffset - rcClient.right) + 1; +- int maxOffset = static_cast<Sci::Position>(pt.x + xOffset - rcClient.left) - 1; ++ const int minOffset = static_cast<Sci::Position>(ptAnchor.x + xOffset - rcClient.right) + 1; ++ const int maxOffset = static_cast<Sci::Position>(pt.x + xOffset - rcClient.left) - 1; + newXY.xOffset = std::max(newXY.xOffset, minOffset); + newXY.xOffset = std::min(newXY.xOffset, maxOffset); + } +@@ -1364,7 +1364,7 @@ + xOffset = newXY.xOffset; + ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); + if (newXY.xOffset > 0) { +- PRectangle rcText = GetTextRectangle(); ++ const PRectangle rcText = GetTextRectangle(); + if (horizontalScrollBarVisible && + rcText.Width() + xOffset > scrollWidth) { + scrollWidth = xOffset + static_cast<Sci::Position>(rcText.Width()); +@@ -1599,7 +1599,7 @@ + void Editor::LinesSplit(int pixelWidth) { + if (!RangeContainsProtected(targetStart, targetEnd)) { + if (pixelWidth == 0) { +- PRectangle rcText = GetTextRectangle(); ++ const PRectangle rcText = GetTextRectangle(); + pixelWidth = static_cast<int>(rcText.Width()); + } + Sci::Line lineStart = pdoc->LineFromPosition(targetStart); +@@ -1675,7 +1675,7 @@ + view.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs); + marginView.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs); + if (view.bufferedDraw) { +- PRectangle rcClient = GetClientRectangle(); ++ const PRectangle rcClient = GetClientRectangle(); + if (!view.pixmapLine->Initialised()) { + + view.pixmapLine->InitPixMap(static_cast<int>(rcClient.Width()), vs.lineHeight, +@@ -1804,9 +1804,9 @@ + void Editor::SetScrollBars() { + RefreshStyleData(); + +- Sci::Line nMax = MaxScrollPos(); +- Sci::Line nPage = LinesOnScreen(); +- bool modified = ModifyScrollBars(nMax + nPage - 1, nPage); ++ const Sci::Line nMax = MaxScrollPos(); ++ const Sci::Line nPage = LinesOnScreen(); ++ const bool modified = ModifyScrollBars(nMax + nPage - 1, nPage); + if (modified) { + DwellEnd(true); + } +@@ -2251,8 +2251,8 @@ + if (pdoc->GetColumn(sel.Range(r).caret.Position()) <= pdoc->GetLineIndentation(lineCurrentPos) && + pdoc->GetColumn(sel.Range(r).caret.Position()) > 0 && pdoc->backspaceUnindents) { + UndoGroup ugInner(pdoc, !ug.Needed()); +- int indentation = pdoc->GetLineIndentation(lineCurrentPos); +- int indentationStep = pdoc->IndentSize(); ++ const int indentation = pdoc->GetLineIndentation(lineCurrentPos); ++ const int indentationStep = pdoc->IndentSize(); + int indentationChange = indentation % indentationStep; + if (indentationChange == 0) + indentationChange = indentationStep; +@@ -2406,7 +2406,7 @@ + } + + void Editor::NotifyIndicatorClick(bool click, Sci::Position position, int modifiers) { +- int mask = pdoc->decorations.AllOnFor(position); ++ const int mask = pdoc->decorations.AllOnFor(position); + if ((click && mask) || pdoc->decorations.ClickNotified()) { + SCNotification scn = {}; + pdoc->decorations.SetClickNotified(click); +@@ -2539,7 +2539,7 @@ + // character is still present else after the previous surviving character. + static inline Sci::Position MovePositionForDeletion(Sci::Position position, Sci::Position startDeletion, Sci::Position length) { + if (position > startDeletion) { +- Sci::Position endDeletion = startDeletion + length; ++ const Sci::Position endDeletion = startDeletion + length; + if (position > endDeletion) { + return position - length; + } else { +@@ -2862,9 +2862,9 @@ + Sci::Line topLineNew; + SelectionPosition newPos; + +- Sci::Line currentLine = pdoc->LineFromPosition(sel.MainCaret()); +- Sci::Line topStutterLine = topLine + caretYSlop; +- Sci::Line bottomStutterLine = ++ const Sci::Line currentLine = pdoc->LineFromPosition(sel.MainCaret()); ++ const Sci::Line topStutterLine = topLine + caretYSlop; ++ const Sci::Line bottomStutterLine = + pdoc->LineFromPosition(PositionFromLocation( + Point::FromInts(lastXChosen - xOffset, direction * vs.lineHeight * LinesToScroll()))) + - caretYSlop - 1; +@@ -3810,26 +3810,26 @@ + return DelWordOrLine(iMessage); + + case SCI_LINECOPY: { +- Sci::Line lineStart = pdoc->LineFromPosition(SelectionStart().Position()); +- Sci::Line lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); ++ const Sci::Line lineStart = pdoc->LineFromPosition(SelectionStart().Position()); ++ const Sci::Line lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); + CopyRangeToClipboard(pdoc->LineStart(lineStart), + pdoc->LineStart(lineEnd + 1)); + } + break; + case SCI_LINECUT: { +- Sci::Line lineStart = pdoc->LineFromPosition(SelectionStart().Position()); +- Sci::Line lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); +- Sci::Position start = pdoc->LineStart(lineStart); +- Sci::Position end = pdoc->LineStart(lineEnd + 1); ++ const Sci::Line lineStart = pdoc->LineFromPosition(SelectionStart().Position()); ++ const Sci::Line lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); ++ const Sci::Position start = pdoc->LineStart(lineStart); ++ const Sci::Position end = pdoc->LineStart(lineEnd + 1); + SetSelection(start, end); + Cut(); + SetLastXChosen(); + } + break; + case SCI_LINEDELETE: { +- Sci::Line line = pdoc->LineFromPosition(sel.MainCaret()); +- Sci::Position start = pdoc->LineStart(line); +- Sci::Position end = pdoc->LineStart(line + 1); ++ const Sci::Line line = pdoc->LineFromPosition(sel.MainCaret()); ++ const Sci::Position start = pdoc->LineStart(line); ++ const Sci::Position end = pdoc->LineStart(line + 1); + pdoc->DeleteChars(start, end - start); + } + break; +@@ -3918,8 +3918,8 @@ + } else { + if (pdoc->GetColumn(caretPosition) <= pdoc->GetLineIndentation(lineCurrentPos) && + pdoc->tabIndents) { +- int indentation = pdoc->GetLineIndentation(lineCurrentPos); +- int indentationStep = pdoc->IndentSize(); ++ const int indentation = pdoc->GetLineIndentation(lineCurrentPos); ++ const int indentationStep = pdoc->IndentSize(); + const Sci::Position posSelect = pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); + sel.Range(r) = SelectionRange(posSelect); + } else { +@@ -3934,10 +3934,10 @@ + } + } + } else { // Multiline +- Sci::Position anchorPosOnLine = sel.Range(r).anchor.Position() - pdoc->LineStart(lineOfAnchor); +- Sci::Position currentPosPosOnLine = caretPosition - pdoc->LineStart(lineCurrentPos); ++ const Sci::Position anchorPosOnLine = sel.Range(r).anchor.Position() - pdoc->LineStart(lineOfAnchor); ++ const Sci::Position currentPosPosOnLine = caretPosition - pdoc->LineStart(lineCurrentPos); + // Multiple lines selected so indent / dedent +- Sci::Line lineTopSel = std::min(lineOfAnchor, lineCurrentPos); ++ const Sci::Line lineTopSel = std::min(lineOfAnchor, lineCurrentPos); + Sci::Line lineBottomSel = std::max(lineOfAnchor, lineCurrentPos); + if (pdoc->LineStart(lineBottomSel) == sel.Range(r).anchor.Position() || pdoc->LineStart(lineBottomSel) == caretPosition) + lineBottomSel--; // If not selecting any characters on a line, do not indent +@@ -4148,7 +4148,7 @@ + if (sel.selType == Selection::selRectangle) + std::sort(rangesInOrder.begin(), rangesInOrder.end()); + for (size_t r=0; r<rangesInOrder.size(); r++) { +- SelectionRange current = rangesInOrder[r]; ++ const SelectionRange current = rangesInOrder[r]; + text.append(RangeText(current.Start().Position(), current.End().Position())); + if (sel.selType == Selection::selRectangle) { + if (pdoc->eolMode != SC_EOL_LF) +@@ -4207,9 +4207,9 @@ + } + + bool Editor::DragThreshold(Point ptStart, Point ptNow) { +- int xMove = static_cast<int>(ptStart.x - ptNow.x); +- int yMove = static_cast<int>(ptStart.y - ptNow.y); +- int distanceSquared = xMove * xMove + yMove * yMove; ++ const int xMove = static_cast<int>(ptStart.x - ptNow.x); ++ const int yMove = static_cast<int>(ptStart.y - ptNow.y); ++ const int distanceSquared = xMove * xMove + yMove * yMove; + return distanceSquared > 16; + } + +@@ -4224,9 +4224,9 @@ + if (inDragDrop == ddDragging) + dropWentOutside = false; + +- bool positionWasInSelection = PositionInSelection(position.Position()); +- +- bool positionOnEdgeOfSelection = ++ const bool positionWasInSelection = PositionInSelection(position.Position()); ++ ++ const bool positionOnEdgeOfSelection = + (position == SelectionStart()) || (position == SelectionEnd()); + + if ((inDragDrop != ddDragging) || !(positionWasInSelection) || +@@ -4298,10 +4298,10 @@ + } + + bool Editor::PointInSelection(Point pt) { +- SelectionPosition pos = SPositionFromLocation(pt, false, true); +- Point ptPos = LocationFromPosition(pos); ++ const SelectionPosition pos = SPositionFromLocation(pt, false, true); ++ const Point ptPos = LocationFromPosition(pos); + for (size_t r=0; r<sel.Count(); r++) { +- SelectionRange range = sel.Range(r); ++ const SelectionRange range = sel.Range(r); + if (range.Contains(pos)) { + bool hit = true; + if (pos == range.Start()) { +@@ -4456,7 +4456,7 @@ + + NotifyIndicatorClick(true, newPos.Position(), modifiers); + +- bool inSelMargin = PointInSelMargin(pt); ++ const bool inSelMargin = PointInSelMargin(pt); + // In margin ctrl+(double)click should always select everything + if (ctrl && inSelMargin) { + SelectAll(); +@@ -4647,7 +4647,7 @@ + } + + void Editor::SetHoverIndicatorPosition(Sci::Position position) { +- Sci::Position hoverIndicatorPosPrev = hoverIndicatorPos; ++ const Sci::Position hoverIndicatorPosPrev = hoverIndicatorPos; + hoverIndicatorPos = INVALID_POSITION; + if (vs.indicatorsDynamic == 0) + return; +@@ -5276,7 +5276,7 @@ + + void Editor::SetAnnotationVisible(int visible) { + if (vs.annotationVisible != visible) { +- bool changedFromOrToHidden = ((vs.annotationVisible != 0) != (visible != 0)); ++ const bool changedFromOrToHidden = ((vs.annotationVisible != 0) != (visible != 0)); + vs.annotationVisible = visible; + if (changedFromOrToHidden) { + int dir = vs.annotationVisible ? 1 : -1; +@@ -5299,7 +5299,7 @@ + line++; + while (line <= lineMaxSubord) { + cs.SetVisible(line, line, true); +- int level = pdoc->GetLevel(line); ++ const int level = pdoc->GetLevel(line); + if (level & SC_FOLDLEVELHEADERFLAG) { + if (cs.GetExpanded(line)) { + line = ExpandLine(line); +@@ -5330,12 +5330,12 @@ + } + + if (action == SC_FOLDACTION_CONTRACT) { +- Sci::Line lineMaxSubord = pdoc->GetLastChild(line); ++ const Sci::Line lineMaxSubord = pdoc->GetLastChild(line); + if (lineMaxSubord > line) { + cs.SetExpanded(line, 0); + cs.SetVisible(line + 1, lineMaxSubord, false); + +- Sci::Line lineCurrent = pdoc->LineFromPosition(sel.MainCaret()); ++ const Sci::Line lineCurrent = pdoc->LineFromPosition(sel.MainCaret()); + if (lineCurrent > line && lineCurrent <= lineMaxSubord) { + // This does not re-expand the fold + EnsureCaretVisible(); +@@ -5372,7 +5372,7 @@ + line++; + cs.SetVisible(line, lineMaxSubord, expanding); + while (line <= lineMaxSubord) { +- int levelLine = pdoc->GetLevel(line); ++ const int levelLine = pdoc->GetLevel(line); + if (levelLine & SC_FOLDLEVELHEADERFLAG) { + SetFoldExpanded(line, expanding); + } +@@ -5428,7 +5428,7 @@ + Redraw(); + } + if (enforcePolicy) { +- Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); ++ const Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); + if (visiblePolicy & VISIBLE_SLOP) { + if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) { + SetTopLine(Platform::Clamp(lineDisplay - visibleSlop, 0, MaxScrollPos())); +@@ -5466,14 +5466,14 @@ + if (expanding) { + cs.SetVisible(0, maxLine-1, true); + for (int line = 0; line < maxLine; line++) { +- int levelLine = pdoc->GetLevel(line); ++ const int levelLine = pdoc->GetLevel(line); + if (levelLine & SC_FOLDLEVELHEADERFLAG) { + SetFoldExpanded(line, true); + } + } + } else { + for (int line = 0; line < maxLine; line++) { +- int level = pdoc->GetLevel(line); ++ const int level = pdoc->GetLevel(line); + if ((level & SC_FOLDLEVELHEADERFLAG) && + (SC_FOLDLEVELBASE == LevelNumber(level))) { + SetFoldExpanded(line, false); +@@ -5540,8 +5540,8 @@ + + void Editor::NeedShown(Sci::Position pos, Sci::Position len) { + if (foldAutomatic & SC_AUTOMATICFOLD_SHOW) { +- Sci::Line lineStart = pdoc->LineFromPosition(pos); +- Sci::Line lineEnd = pdoc->LineFromPosition(pos+len); ++ const Sci::Line lineStart = pdoc->LineFromPosition(pos); ++ const Sci::Line lineEnd = pdoc->LineFromPosition(pos+len); + for (Sci::Line line = lineStart; line <= lineEnd; line++) { + EnsureLineVisible(line, false); + } +@@ -7693,7 +7693,7 @@ + SelectionSegment segmentLine(SelectionPosition(pdoc->LineStart(static_cast<int>(wParam))), + SelectionPosition(pdoc->LineEnd(static_cast<int>(wParam)))); + for (size_t r=0; r<sel.Count(); r++) { +- SelectionSegment portion = sel.Range(r).Intersect(segmentLine); ++ const SelectionSegment portion = sel.Range(r).Intersect(segmentLine); + if (portion.start.IsValid()) { + return (iMessage == SCI_GETLINESELSTARTPOSITION) ? portion.start.Position() : portion.end.Position(); + } +diff -r 797ed6c538fd -r d046ce80d590 src/ExternalLexer.cxx +--- a/src/ExternalLexer.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/ExternalLexer.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -65,7 +65,7 @@ + GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName"); + GetLexerFactoryFunction fnFactory = (GetLexerFactoryFunction)(sptr_t)lib->FindFunction("GetLexerFactory"); + +- int nl = GetLexerCount(); ++ const int nl = GetLexerCount(); + + for (int i = 0; i < nl; i++) { + // Assign a buffer for the lexer name. +diff -r 797ed6c538fd -r d046ce80d590 src/Indicator.cxx +--- a/src/Indicator.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/Indicator.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -36,7 +36,7 @@ + int ymid = static_cast<int>(rc.bottom + rc.top) / 2; + if (sacDraw.style == INDIC_SQUIGGLE) { + int x = int(rc.left+0.5); +- int xLast = int(rc.right+0.5); ++ const int xLast = int(rc.right+0.5); + int y = 0; + surface->MoveTo(x, static_cast<int>(rc.top) + y); + while (x < xLast) { +diff -r 797ed6c538fd -r d046ce80d590 src/LineMarker.cxx +--- a/src/LineMarker.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/LineMarker.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -122,11 +122,11 @@ + int minDim = Platform::Minimum(static_cast<int>(rc.Width()), static_cast<int>(rc.Height())); + minDim--; // Ensure does not go beyond edge + int centreX = static_cast<int>(floor((rc.right + rc.left) / 2.0)); +- int centreY = static_cast<int>(floor((rc.bottom + rc.top) / 2.0)); +- int dimOn2 = minDim / 2; +- int dimOn4 = minDim / 4; ++ const int centreY = static_cast<int>(floor((rc.bottom + rc.top) / 2.0)); ++ const int dimOn2 = minDim / 2; ++ const int dimOn4 = minDim / 4; + int blobSize = dimOn2-1; +- int armSize = dimOn2-2; ++ const int armSize = dimOn2-2; + if (marginStyle == SC_MARGIN_NUMBER || marginStyle == SC_MARGIN_TEXT || marginStyle == SC_MARGIN_RTEXT) { + // On textual margins move marker to the left to try to avoid overlapping the text + centreX = static_cast<int>(rc.left) + dimOn2 + 1; +@@ -384,7 +384,7 @@ + rcLeft.right = rcLeft.left + 4; + surface->FillRectangle(rcLeft, back); + } else if (markType == SC_MARK_BOOKMARK) { +- int halfHeight = minDim / 3; ++ const int halfHeight = minDim / 3; + Point pts[] = { + Point::FromInts(static_cast<int>(rc.left), centreY-halfHeight), + Point::FromInts(static_cast<int>(rc.right) - 3, centreY - halfHeight), +diff -r 797ed6c538fd -r d046ce80d590 src/MarginView.cxx +--- a/src/MarginView.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/MarginView.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -64,10 +64,10 @@ + enum { xa = 1 }; // gap before start + int w = static_cast<int>(rcPlace.right - rcPlace.left) - xa - 1; + +- bool xStraight = isEndMarker; // x-mirrored symbol for start marker ++ const bool xStraight = isEndMarker; // x-mirrored symbol for start marker + +- int x0 = static_cast<int>(xStraight ? rcPlace.left : rcPlace.right - 1); +- int y0 = static_cast<int>(rcPlace.top); ++ const int x0 = static_cast<int>(xStraight ? rcPlace.left : rcPlace.right - 1); ++ const int y0 = static_cast<int>(rcPlace.top); + + int dy = static_cast<int>(rcPlace.bottom - rcPlace.top) / 5; + int y = static_cast<int>(rcPlace.bottom - rcPlace.top) / 2 + dy; +@@ -205,7 +205,7 @@ + // Required because of special way brush is created for selection margin + // Ensure patterns line up when scrolling with separate margin view + // by choosing correctly aligned variant. +- bool invertPhase = static_cast<int>(ptOrigin.y) & 1; ++ const bool invertPhase = static_cast<int>(ptOrigin.y) & 1; + surface->FillRectangle(rcSelMargin, + invertPhase ? *pixmapSelPattern : *pixmapSelPatternOffset1); + } else { +@@ -238,7 +238,7 @@ + // be displayed until the last of a sequence of whitespace. + bool needWhiteClosure = false; + if (vs.ms[margin].mask & SC_MASK_FOLDERS) { +- int level = model.pdoc->GetLevel(model.cs.DocFromDisplay(visibleLine)); ++ const int level = model.pdoc->GetLevel(model.cs.DocFromDisplay(visibleLine)); + if (level & SC_FOLDLEVELWHITEFLAG) { + Sci::Line lineBack = model.cs.DocFromDisplay(visibleLine); + int levelPrev = level; +@@ -380,7 +380,7 @@ + sprintf(number, "%d", lineDoc + 1); + if (model.foldFlags & (SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE)) { + if (model.foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { +- int lev = model.pdoc->GetLevel(lineDoc); ++ const int lev = model.pdoc->GetLevel(lineDoc); + sprintf(number, "%c%c %03X %03X", + (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', + (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', +@@ -388,7 +388,7 @@ + lev >> 16 + ); + } else { +- int state = model.pdoc->GetLineState(lineDoc); ++ const int state = model.pdoc->GetLineState(lineDoc); + sprintf(number, "%0X", state); + } + } +diff -r 797ed6c538fd -r d046ce80d590 src/Partitioning.h +--- a/src/Partitioning.h Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/Partitioning.h Thu Apr 06 21:04:37 2017 +1000 +@@ -27,9 +27,9 @@ + void RangeAddDelta(int start, int end, int delta) { + // end is 1 past end, so end-start is number of elements to change + int i = 0; +- int rangeLength = end - start; ++ const int rangeLength = end - start; + int range1Length = rangeLength; +- int part1Left = part1Length - start; ++ const int part1Left = part1Length - start; + if (range1Length > part1Left) + range1Length = part1Left; + while (i < range1Length) { +@@ -170,7 +170,7 @@ + int lower = 0; + int upper = body->Length()-1; + do { +- int middle = (upper + lower + 1) / 2; // Round high ++ const int middle = (upper + lower + 1) / 2; // Round high + int posMiddle = body->ValueAt(middle); + if (middle > stepPartition) + posMiddle += stepLength; +diff -r 797ed6c538fd -r d046ce80d590 src/PerLine.cxx +--- a/src/PerLine.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/PerLine.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -181,9 +181,9 @@ + Sci::Line LineMarkers::MarkerNext(Sci::Line lineStart, int mask) const { + if (lineStart < 0) + lineStart = 0; +- Sci::Line length = markers.Length(); ++ const Sci::Line length = markers.Length(); + for (Sci::Line iLine = lineStart; iLine < length; iLine++) { +- MarkerHandleSet *onLine = markers[iLine]; ++ const MarkerHandleSet *onLine = markers[iLine]; + if (onLine && ((onLine->MarkValue() & mask) != 0)) + //if ((pdoc->GetMark(iLine) & lParam) != 0) + return iLine; +@@ -318,7 +318,7 @@ + + int LineState::SetLineState(Sci::Line line, int state) { + lineStates.EnsureLength(line + 1); +- int stateOld = lineStates[line]; ++ const int stateOld = lineStates[line]; + lineStates[line] = state; + return stateOld; + } +@@ -410,7 +410,7 @@ + } + + static char *AllocateAnnotation(int length, int style) { +- size_t len = sizeof(AnnotationHeader) + length + ((style == IndividualStyles) ? length : 0); ++ const size_t len = sizeof(AnnotationHeader) + length + ((style == IndividualStyles) ? length : 0); + char *ret = new char[len](); + return ret; + } +@@ -418,7 +418,7 @@ + void LineAnnotation::SetText(Sci::Line line, const char *text) { + if (text && (line >= 0)) { + annotations.EnsureLength(line+1); +- int style = Style(line); ++ const int style = Style(line); + if (annotations[line]) { + delete []annotations[line]; + } +diff -r 797ed6c538fd -r d046ce80d590 src/PositionCache.cxx +--- a/src/PositionCache.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/PositionCache.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -189,7 +189,7 @@ + int LineLayout::FindBefore(XYPOSITION x, int lower, int upper) const { + do { + int middle = (upper + lower + 1) / 2; // Round high +- XYPOSITION posMiddle = positions[middle]; ++ const XYPOSITION posMiddle = positions[middle]; + if (x < posMiddle) { + upper = middle - 1; + } else { +@@ -469,11 +469,11 @@ + } + + if (breakForSelection) { +- SelectionPosition posStart(posLineStart); +- SelectionPosition posEnd(posLineStart + lineRange.end); +- SelectionSegment segmentLine(posStart, posEnd); ++ const SelectionPosition posStart(posLineStart); ++ const SelectionPosition posEnd(posLineStart + lineRange.end); ++ const SelectionSegment segmentLine(posStart, posEnd); + for (size_t r=0; r<psel->Count(); r++) { +- SelectionSegment portion = psel->Range(r).Intersect(segmentLine); ++ const SelectionSegment portion = psel->Range(r).Intersect(segmentLine); + if (!(portion.start == portion.end)) { + if (portion.start.IsValid()) + Insert(portion.start.Position() - posLineStart); +@@ -653,7 +653,7 @@ + } + + void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber, +- const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) { ++ const char *s, unsigned int len, XYPOSITION *positions, const Document *pdoc) { + + allClear = false; + size_t probe = pces.size(); // Out of bounds +diff -r 797ed6c538fd -r d046ce80d590 src/PositionCache.h +--- a/src/PositionCache.h Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/PositionCache.h Thu Apr 06 21:04:37 2017 +1000 +@@ -214,7 +214,7 @@ + void SetSize(size_t size_); + size_t GetSize() const { return pces.size(); } + void MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber, +- const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc); ++ const char *s, unsigned int len, XYPOSITION *positions, const Document *pdoc); + }; + + inline bool IsSpaceOrTab(int ch) { +diff -r 797ed6c538fd -r d046ce80d590 src/RESearch.cxx +--- a/src/RESearch.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/RESearch.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -358,7 +358,7 @@ + incr = 0; // Most of the time, will skip the char "naturally". + int c; + int result = -1; +- unsigned char bsc = *pattern; ++ const unsigned char bsc = *pattern; + if (!bsc) { + // Avoid overrun + result = '\\'; // \ at end of pattern, take it literally +@@ -376,9 +376,9 @@ + result = escapeValue(bsc); + break; + case 'x': { +- unsigned char hd1 = *(pattern + 1); +- unsigned char hd2 = *(pattern + 2); +- int hexValue = GetHexaChar(hd1, hd2); ++ const unsigned char hd1 = *(pattern + 1); ++ const unsigned char hd2 = *(pattern + 2); ++ const int hexValue = GetHexaChar(hd1, hd2); + if (hexValue >= 0) { + result = hexValue; + incr = 2; // Must skip the digits +diff -r 797ed6c538fd -r d046ce80d590 src/RunStyles.cxx +--- a/src/RunStyles.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/RunStyles.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -38,7 +38,7 @@ + // If there is no run boundary at position, insert one continuing style. + int RunStyles::SplitRun(int position) { + int run = RunFromPosition(position); +- int posRun = starts->PositionFromPartition(run); ++ const int posRun = starts->PositionFromPartition(run); + if (posRun < position) { + int runStyle = ValueAt(position); + run++; +@@ -91,12 +91,12 @@ + } + + int RunStyles::FindNextChange(int position, int end) const { +- int run = starts->PartitionFromPosition(position); ++ const int run = starts->PartitionFromPosition(position); + if (run < starts->Partitions()) { +- int runChange = starts->PositionFromPartition(run); ++ const int runChange = starts->PositionFromPartition(run); + if (runChange > position) + return runChange; +- int nextChange = starts->PositionFromPartition(run + 1); ++ const int nextChange = starts->PositionFromPartition(run + 1); + if (nextChange > position) { + return nextChange; + } else if (position < end) { +@@ -273,7 +273,7 @@ + } + int start=0; + while (start < Length()) { +- int end = EndRun(start); ++ const int end = EndRun(start); + if (start >= end) { + throw std::runtime_error("RunStyles: Partition is 0 length."); + } +diff -r 797ed6c538fd -r d046ce80d590 src/ScintillaBase.cxx +--- a/src/ScintillaBase.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/ScintillaBase.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -79,7 +79,7 @@ + } + + void ScintillaBase::AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS) { +- bool isFillUp = ac.Active() && ac.IsFillUpChar(*s); ++ const bool isFillUp = ac.Active() && ac.IsFillUpChar(*s); + if (!isFillUp) { + Editor::AddCharUTF(s, len, treatAsDBCS); + } +@@ -365,7 +365,7 @@ + } + + void ScintillaBase::AutoCompleteCompleted(char ch, unsigned int completionMethod) { +- int item = ac.GetSelection(); ++ const int item = ac.GetSelection(); + if (item == -1) { + AutoCompleteCancel(); + return; +@@ -415,7 +415,7 @@ + + int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) const { + if (ac.Active()) { +- int item = ac.GetSelection(); ++ const int item = ac.GetSelection(); + if (item != -1) { + const std::string selected = ac.GetValue(item); + if (buffer != NULL) +@@ -453,7 +453,7 @@ + wMain); + // If the call-tip window would be out of the client + // space +- PRectangle rcClient = GetClientRectangle(); ++ const PRectangle rcClient = GetClientRectangle(); + int offset = vs.lineHeight + static_cast<int>(rc.Height()); + // adjust so it displays above the text. + if (rc.bottom > rcClient.bottom && rc.Height() < rcClient.Height()) { +@@ -485,7 +485,7 @@ + + void ScintillaBase::ContextMenu(Point pt) { + if (displayPopupMenu) { +- bool writable = !WndProc(SCI_GETREADONLY, 0, 0); ++ const bool writable = !WndProc(SCI_GETREADONLY, 0, 0); + popup.CreatePopUp(); + AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo()); + AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo()); +diff -r 797ed6c538fd -r d046ce80d590 src/Selection.cxx +--- a/src/Selection.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/Selection.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -36,7 +36,7 @@ + virtualSpace = 0; + } + if (position > startChange) { +- Sci::Position endDeletion = startChange + length; ++ const Sci::Position endDeletion = startChange + length; + if (position > endDeletion) { + position -= length; + } else { +@@ -131,8 +131,8 @@ + } + + bool SelectionRange::Trim(SelectionRange range) { +- SelectionPosition startRange = range.Start(); +- SelectionPosition endRange = range.End(); ++ const SelectionPosition startRange = range.Start(); ++ const SelectionPosition endRange = range.End(); + SelectionPosition start = Start(); + SelectionPosition end = End(); + PLATFORM_ASSERT(start <= end); +diff -r 797ed6c538fd -r d046ce80d590 src/SplitVector.h +--- a/src/SplitVector.h Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/SplitVector.h Thu Apr 06 21:04:37 2017 +1000 +@@ -251,7 +251,7 @@ + // Split into up to 2 ranges, before and after the split then use memcpy on each. + int range1Length = 0; + if (position < part1Length) { +- int part1AfterPosition = part1Length - position; ++ const int part1AfterPosition = part1Length - position; + range1Length = retrieveLength; + if (range1Length > part1AfterPosition) + range1Length = part1AfterPosition; +diff -r 797ed6c538fd -r d046ce80d590 src/UniConversion.cxx +--- a/src/UniConversion.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/UniConversion.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -23,7 +23,7 @@ + unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { + unsigned int len = 0; + for (unsigned int i = 0; i < tlen && uptr[i];) { +- unsigned int uch = uptr[i]; ++ const unsigned int uch = uptr[i]; + if (uch < 0x80) { + len++; + } else if (uch < 0x800) { +@@ -43,7 +43,7 @@ + void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) { + unsigned int k = 0; + for (unsigned int i = 0; i < tlen && uptr[i];) { +- unsigned int uch = uptr[i]; ++ const unsigned int uch = uptr[i]; + if (uch < 0x80) { + putf[k++] = static_cast<char>(uch); + } else if (uch < 0x800) { +@@ -53,7 +53,7 @@ + (uch <= SURROGATE_TRAIL_LAST)) { + // Half a surrogate pair + i++; +- unsigned int xch = 0x10000 + ((uch & 0x3ff) << 10) + (uptr[i] & 0x3ff); ++ const unsigned int xch = 0x10000 + ((uch & 0x3ff) << 10) + (uptr[i] & 0x3ff); + putf[k++] = static_cast<char>(0xF0 | (xch >> 18)); + putf[k++] = static_cast<char>(0x80 | ((xch >> 12) & 0x3f)); + putf[k++] = static_cast<char>(0x80 | ((xch >> 6) & 0x3f)); +@@ -85,7 +85,7 @@ + size_t ulen = 0; + size_t charLen; + for (size_t i = 0; i<len;) { +- unsigned char ch = static_cast<unsigned char>(s[i]); ++ const unsigned char ch = static_cast<unsigned char>(s[i]); + if (ch < 0x80) { + charLen = 1; + } else if (ch < 0x80 + 0x40 + 0x20) { +@@ -301,7 +301,7 @@ + } + + int UTF8DrawBytes(const unsigned char *us, int len) { +- int utf8StatusNext = UTF8Classify(us, len); ++ const int utf8StatusNext = UTF8Classify(us, len); + return (utf8StatusNext & UTF8MaskInvalid) ? 1 : (utf8StatusNext & UTF8MaskWidth); + } + +diff -r 797ed6c538fd -r d046ce80d590 src/ViewStyle.cxx +--- a/src/ViewStyle.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/ViewStyle.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -565,31 +565,31 @@ + wrapStateWanted = eWrapNone; + break; + } +- bool changed = wrapState != wrapStateWanted; ++ const bool changed = wrapState != wrapStateWanted; + wrapState = wrapStateWanted; + return changed; + } + + bool ViewStyle::SetWrapVisualFlags(int wrapVisualFlags_) { +- bool changed = wrapVisualFlags != wrapVisualFlags_; ++ const bool changed = wrapVisualFlags != wrapVisualFlags_; + wrapVisualFlags = wrapVisualFlags_; + return changed; + } + + bool ViewStyle::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_) { +- bool changed = wrapVisualFlagsLocation != wrapVisualFlagsLocation_; ++ const bool changed = wrapVisualFlagsLocation != wrapVisualFlagsLocation_; + wrapVisualFlagsLocation = wrapVisualFlagsLocation_; + return changed; + } + + bool ViewStyle::SetWrapVisualStartIndent(int wrapVisualStartIndent_) { +- bool changed = wrapVisualStartIndent != wrapVisualStartIndent_; ++ const bool changed = wrapVisualStartIndent != wrapVisualStartIndent_; + wrapVisualStartIndent = wrapVisualStartIndent_; + return changed; + } + + bool ViewStyle::SetWrapIndentMode(int wrapIndentMode_) { +- bool changed = wrapIndentMode != wrapIndentMode_; ++ const bool changed = wrapIndentMode != wrapIndentMode_; + wrapIndentMode = wrapIndentMode_; + return changed; + } +diff -r 797ed6c538fd -r d046ce80d590 src/XPM.cxx +--- a/src/XPM.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/XPM.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -117,24 +117,24 @@ + + for (int y=0; y<height; y++) { + const char *lform = linesForm[y+nColours+1]; +- size_t len = MeasureLength(lform); ++ const size_t len = MeasureLength(lform); + for (size_t x = 0; x<len; x++) + pixels[y * width + x] = static_cast<unsigned char>(lform[x]); + } + } + +-void XPM::Draw(Surface *surface, PRectangle &rc) { ++void XPM::Draw(Surface *surface, const PRectangle &rc) { + if (pixels.empty()) { + return; + } + // Centre the pixmap +- int startY = static_cast<int>(rc.top + (rc.Height() - height) / 2); +- int startX = static_cast<int>(rc.left + (rc.Width() - width) / 2); ++ const int startY = static_cast<int>(rc.top + (rc.Height() - height) / 2); ++ const int startX = static_cast<int>(rc.left + (rc.Width() - width) / 2); + for (int y=0; y<height; y++) { + int prevCode = 0; + int xStartRun = 0; + for (int x=0; x<width; x++) { +- int code = pixels[y * width + x]; ++ const int code = pixels[y * width + x]; + if (code != prevCode) { + FillRun(surface, prevCode, startX + xStartRun, startY + y, startX + x); + xStartRun = x; +diff -r 797ed6c538fd -r d046ce80d590 src/XPM.h +--- a/src/XPM.h Thu Apr 06 20:19:23 2017 +1000 ++++ b/src/XPM.h Thu Apr 06 21:04:37 2017 +1000 +@@ -31,7 +31,7 @@ + void Init(const char *textForm); + void Init(const char *const *linesForm); + /// Decompose image into runs and use FillRectangle for each run +- void Draw(Surface *surface, PRectangle &rc); ++ void Draw(Surface *surface, const PRectangle &rc); + int GetHeight() const { return height; } + int GetWidth() const { return width; } + void PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const; +diff -r 797ed6c538fd -r d046ce80d590 win32/HanjaDic.cxx +--- a/win32/HanjaDic.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/win32/HanjaDic.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -112,7 +112,7 @@ + if (dict.IsHanja(static_cast<int>(inout[i]))) { // Pass hanja only! + conv[0] = inout[i]; + BSTR bstrHanja = SysAllocString(conv); +- HRESULT hr = dict.HJinterface->HanjaToHangul(bstrHanja, &bstrHangul); ++ const HRESULT hr = dict.HJinterface->HanjaToHangul(bstrHanja, &bstrHangul); + if (SUCCEEDED(hr)) { + inout[i] = static_cast<wchar_t>(bstrHangul[0]); + changed += 1; +diff -r 797ed6c538fd -r d046ce80d590 win32/PlatWin.cxx +--- a/win32/PlatWin.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/win32/PlatWin.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -129,7 +129,7 @@ + } + + if (pIDWriteFactory) { +- HRESULT hr = pIDWriteFactory->CreateRenderingParams(&defaultRenderingParams); ++ const HRESULT hr = pIDWriteFactory->CreateRenderingParams(&defaultRenderingParams); + if (SUCCEEDED(hr)) { + unsigned int clearTypeContrast; + if (::SystemParametersInfo(SPI_GETFONTSMOOTHINGCONTRAST, 0, &clearTypeContrast, 0)) { +@@ -212,7 +212,7 @@ + return 0; + } + } else { +- HRESULT hr = pTextFormat->GetFontFamilyName(lf.lfFaceName, LF_FACESIZE); ++ const HRESULT hr = pTextFormat->GetFontFamilyName(lf.lfFaceName, LF_FACESIZE); + if (!SUCCEEDED(hr)) { + return 0; + } +@@ -393,7 +393,7 @@ + FontID FontCached::FindOrCreate(const FontParameters &fp) { + FontID ret = 0; + ::EnterCriticalSection(&crPlatformLock); +- int hashFind = HashFont(fp); ++ const int hashFind = HashFont(fp); + for (FontCached *cur=first; cur; cur=cur->next) { + if ((cur->hash == hashFind) && + cur->SameAs(fp)) { +@@ -843,7 +843,7 @@ + for (int y=height-1; y>=0; y--) { + for (int x=0; x<width; x++) { + unsigned char *pixel = image + (y*width+x) * 4; +- unsigned char alpha = pixelsImage[3]; ++ const unsigned char alpha = pixelsImage[3]; + // Input is RGBA, output is BGRA with premultiplied alpha + pixel[2] = static_cast<unsigned char>((*pixelsImage++) * alpha / 255); + pixel[1] = static_cast<unsigned char>((*pixelsImage++) * alpha / 255); +@@ -952,7 +952,7 @@ + } + // Map the widths given for UTF-16 characters back onto the UTF-8 input string + for (int ui = 0; ui < fit; ui++) { +- unsigned int lenChar = UTF8BytesOfLead[static_cast<unsigned char>(s[i])]; ++ const unsigned int lenChar = UTF8BytesOfLead[static_cast<unsigned char>(s[i])]; + if (lenChar == 4) { // Non-BMP + ui++; + } +@@ -1211,7 +1211,7 @@ + desiredFormat = psurfOther->pRenderTarget->GetPixelFormat(); + #endif + desiredFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; +- HRESULT hr = psurfOther->pRenderTarget->CreateCompatibleRenderTarget( ++ const HRESULT hr = psurfOther->pRenderTarget->CreateCompatibleRenderTarget( + &desiredSize, NULL, &desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &pCompatibleRenderTarget); + if (SUCCEEDED(hr)) { + pRenderTarget = pCompatibleRenderTarget; +@@ -1236,7 +1236,7 @@ + if (pBrush) { + pBrush->SetColor(col); + } else { +- HRESULT hr = pRenderTarget->CreateSolidColorBrush(col, &pBrush); ++ const HRESULT hr = pRenderTarget->CreateSolidColorBrush(col, &pBrush); + if (!SUCCEEDED(hr) && pBrush) { + pBrush->Release(); + pBrush = 0; +@@ -1297,18 +1297,18 @@ + + void SurfaceD2D::LineTo(int x_, int y_) { + if (pRenderTarget) { +- int xDiff = x_ - x; +- int xDelta = Delta(xDiff); +- int yDiff = y_ - y; +- int yDelta = Delta(yDiff); ++ const int xDiff = x_ - x; ++ const int xDelta = Delta(xDiff); ++ const int yDiff = y_ - y; ++ const int yDelta = Delta(yDiff); + if ((xDiff == 0) || (yDiff == 0)) { + // Horizontal or vertical lines can be more precisely drawn as a filled rectangle +- int xEnd = x_ - xDelta; +- int left = Platform::Minimum(x, xEnd); +- int width = abs(x - xEnd) + 1; +- int yEnd = y_ - yDelta; +- int top = Platform::Minimum(y, yEnd); +- int height = abs(y - yEnd) + 1; ++ const int xEnd = x_ - xDelta; ++ const int left = Platform::Minimum(x, xEnd); ++ const int width = abs(x - xEnd) + 1; ++ const int yEnd = y_ - yDelta; ++ const int top = Platform::Minimum(y, yEnd); ++ const int height = abs(y - yEnd) + 1; + D2D1_RECT_F rectangle1 = D2D1::RectF(static_cast<float>(left), static_cast<float>(top), + static_cast<float>(left+width), static_cast<float>(top+height)); + pRenderTarget->FillRectangle(&rectangle1, pBrush); +@@ -1455,7 +1455,7 @@ + for (int yPixel=0; yPixel<height; yPixel++) { + for (int xPixel = 0; xPixel<width; xPixel++) { + unsigned char *pixel = &image[0] + (yPixel*width + xPixel) * 4; +- unsigned char alpha = pixelsImage[3]; ++ const unsigned char alpha = pixelsImage[3]; + // Input is RGBA, output is BGRA with premultiplied alpha + pixel[2] = (*pixelsImage++) * alpha / 255; + pixel[1] = (*pixelsImage++) * alpha / 255; +@@ -1468,7 +1468,7 @@ + D2D1_SIZE_U size = D2D1::SizeU(width, height); + D2D1_BITMAP_PROPERTIES props = {{DXGI_FORMAT_B8G8R8A8_UNORM, + D2D1_ALPHA_MODE_PREMULTIPLIED}, 72.0, 72.0}; +- HRESULT hr = pRenderTarget->CreateBitmap(size, &image[0], ++ const HRESULT hr = pRenderTarget->CreateBitmap(size, &image[0], + width * 4, &props, &bitmap); + if (SUCCEEDED(hr)) { + D2D1_RECT_F rcDestination = {rc.left, rc.top, rc.right, rc.bottom}; +@@ -1525,7 +1525,7 @@ + + // Explicitly creating a text layout appears a little faster + IDWriteTextLayout *pTextLayout; +- HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, ++ const HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, + rc.Width(), rc.Height(), &pTextLayout); + if (SUCCEEDED(hr)) { + D2D1_POINT_2F origin = {rc.left, ybase-yAscent}; +@@ -1578,7 +1578,7 @@ + if (pIDWriteFactory && pTextFormat) { + // Create a layout + IDWriteTextLayout *pTextLayout = 0; +- HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 1000.0, 1000.0, &pTextLayout); ++ const HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 1000.0, 1000.0, &pTextLayout); + if (SUCCEEDED(hr)) { + DWRITE_TEXT_METRICS textMetrics; + if (SUCCEEDED(pTextLayout->GetMetrics(&textMetrics))) +@@ -1602,7 +1602,7 @@ + SetFont(font_); + // Create a layout + IDWriteTextLayout *pTextLayout = 0; +- HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 10000.0, 1000.0, &pTextLayout); ++ const HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 10000.0, 1000.0, &pTextLayout); + if (!SUCCEEDED(hr)) + return; + if (!SUCCEEDED(pTextLayout->GetClusterMetrics(clusterMetrics, clusters, &count))) +@@ -1625,7 +1625,7 @@ + const unsigned char *us = reinterpret_cast<const unsigned char *>(s); + int i=0; + while (ui<fit) { +- unsigned char uch = us[i]; ++ const unsigned char uch = us[i]; + unsigned int lenChar = 1; + if (uch >= (0x80 + 0x40 + 0x20 + 0x10)) { + lenChar = 4; +@@ -1683,7 +1683,7 @@ + // Create a layout + IDWriteTextLayout *pTextLayout = 0; + const WCHAR wch = ch; +- HRESULT hr = pIDWriteFactory->CreateTextLayout(&wch, 1, pTextFormat, 1000.0, 1000.0, &pTextLayout); ++ const HRESULT hr = pIDWriteFactory->CreateTextLayout(&wch, 1, pTextFormat, 1000.0, 1000.0, &pTextLayout); + if (SUCCEEDED(hr)) { + DWRITE_TEXT_METRICS textMetrics; + if (SUCCEEDED(pTextLayout->GetMetrics(&textMetrics))) +@@ -1726,7 +1726,7 @@ + IDWriteTextLayout *pTextLayout = 0; + const WCHAR wszAllAlpha[] = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + const size_t lenAllAlpha = wcslen(wszAllAlpha); +- HRESULT hr = pIDWriteFactory->CreateTextLayout(wszAllAlpha, static_cast<UINT32>(lenAllAlpha), ++ const HRESULT hr = pIDWriteFactory->CreateTextLayout(wszAllAlpha, static_cast<UINT32>(lenAllAlpha), + pTextFormat, 1000.0, 1000.0, &pTextLayout); + if (SUCCEEDED(hr)) { + DWRITE_TEXT_METRICS textMetrics; +@@ -1812,7 +1812,7 @@ + } + + void Window::SetPositionRelative(PRectangle rc, Window w) { +- LONG style = ::GetWindowLong(static_cast<HWND>(wid), GWL_STYLE); ++ const LONG style = ::GetWindowLong(static_cast<HWND>(wid), GWL_STYLE); + if (style & WS_POPUP) { + POINT ptOther = {0, 0}; + ::ClientToScreen(static_cast<HWND>(w.GetID()), &ptOther); +@@ -2194,7 +2194,7 @@ + SelectFont(hdc, oldFont); + ::ReleaseDC(lb, hdc); + +- int widthDesired = Platform::Maximum(textSize.cx, (len + 1) * tm.tmAveCharWidth); ++ const int widthDesired = Platform::Maximum(textSize.cx, (len + 1) * tm.tmAveCharWidth); + if (width < widthDesired) + width = widthDesired; + +@@ -2253,7 +2253,7 @@ + } + + void ListBoxX::GetValue(int n, char *value, int len) { +- ListItemData item = lti.Get(n); ++ const ListItemData item = lti.Get(n); + strncpy(value, item.text, len); + value[len-1] = '\0'; + } +@@ -2289,7 +2289,7 @@ + ::SetTextColor(pDrawItem->hDC, ::GetSysColor(COLOR_WINDOWTEXT)); + } + +- ListItemData item = lti.Get(pDrawItem->itemID); ++ const ListItemData item = lti.Get(pDrawItem->itemID); + int pixId = item.pixId; + const char *text = item.text; + int len = static_cast<int>(strlen(text)); +@@ -2305,13 +2305,13 @@ + } + + // Draw the image, if any +- RGBAImage *pimage = images.Get(pixId); ++ const RGBAImage *pimage = images.Get(pixId); + if (pimage) { + Surface *surfaceItem = Surface::Allocate(technology); + if (surfaceItem) { + if (technology == SCWIN_TECH_GDI) { + surfaceItem->Init(pDrawItem->hDC, pDrawItem->hwndItem); +- long left = pDrawItem->rcItem.left + static_cast<int>(ItemInset.x + ImageInset.x); ++ const long left = pDrawItem->rcItem.left + static_cast<int>(ItemInset.x + ImageInset.x); + PRectangle rcImage = PRectangle::FromInts(left, pDrawItem->rcItem.top, + left + images.GetWidth(), pDrawItem->rcItem.bottom); + surfaceItem->DrawRGBAImage(rcImage, +@@ -2339,7 +2339,7 @@ + if (SUCCEEDED(hr)) { + surfaceItem->Init(pDCRT, pDrawItem->hwndItem); + pDCRT->BeginDraw(); +- long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x); ++ const long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x); + PRectangle rcImage = PRectangle::FromInts(left, pDrawItem->rcItem.top, + left + images.GetWidth(), pDrawItem->rcItem.bottom); + surfaceItem->DrawRGBAImage(rcImage, +@@ -2371,7 +2371,7 @@ + } + + lti.AllocItem(text, pixId); +- unsigned int len = static_cast<unsigned int>(strlen(text)); ++ const unsigned int len = static_cast<unsigned int>(strlen(text)); + if (maxItemCharacters < len) { + maxItemCharacters = len; + widestItem = text; +@@ -2383,7 +2383,7 @@ + // the listbox is not visible. + SetRedraw(false); + Clear(); +- size_t size = strlen(list); ++ const size_t size = strlen(list); + char *words = lti.SetWords(list); + char *startword = words; + char *numword = NULL; +@@ -2422,7 +2422,7 @@ + + int ListBoxX::ItemHeight() const { + int itemHeight = lineHeight + (static_cast<int>(TextInset.y) * 2); +- int pixHeight = images.GetHeight() + (static_cast<int>(ImageInset.y) * 2); ++ const int pixHeight = images.GetHeight() + (static_cast<int>(ImageInset.y) * 2); + if (itemHeight < pixHeight) { + itemHeight = pixHeight; + } +@@ -2570,8 +2570,8 @@ + // window caption height + frame, even if one is hovering over the bottom edge of + // the frame, so workaround that here + if (hit >= HTTOP && hit <= HTTOPRIGHT) { +- int minHeight = GetSystemMetrics(SM_CYMINTRACK); +- int yPos = GET_Y_LPARAM(lParam); ++ const int minHeight = GetSystemMetrics(SM_CYMINTRACK); ++ const int yPos = GET_Y_LPARAM(lParam); + if ((rc.Height() < minHeight) && (yPos > ((rc.top + rc.bottom)/2))) { + hit += HTBOTTOM - HTTOP; + } +@@ -2625,10 +2625,10 @@ + void ListBoxX::CentreItem(int n) { + // If below mid point, scroll up to centre, but with more items below if uneven + if (n >= 0) { +- POINT extent = GetClientExtent(); +- int visible = extent.y/ItemHeight(); ++ const POINT extent = GetClientExtent(); ++ const int visible = extent.y/ItemHeight(); + if (visible < Length()) { +- LRESULT top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0); ++ const LRESULT top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0); + int half = (visible - 1) / 2; + if (n > (top + half)) + ::SendMessage(lb, LB_SETTOPINDEX, n - half , 0); +@@ -2680,7 +2680,7 @@ + case WM_LBUTTONDOWN: { + // We must take control of selection to prevent the ListBox activating + // the popup +- LRESULT lResult = ::SendMessage(hWnd, LB_ITEMFROMPOINT, 0, lParam); ++ const LRESULT lResult = ::SendMessage(hWnd, LB_ITEMFROMPOINT, 0, lParam); + int item = LOWORD(lResult); + if (HIWORD(lResult) == 0 && item >= 0) { + ::SendMessage(hWnd, LB_SETCURSEL, item, 0); +@@ -2816,7 +2816,7 @@ + case WM_MOUSEWHEEL: + wheelDelta -= static_cast<short>(HIWORD(wParam)); + if (abs(wheelDelta) >= WHEEL_DELTA) { +- int nRows = GetVisibleRows(); ++ const int nRows = GetVisibleRows(); + int linesToScroll = 1; + if (nRows > 1) { + linesToScroll = nRows - 1; +@@ -2939,12 +2939,12 @@ + LARGE_INTEGER lBegin; + lBegin.HighPart = bigBit; + lBegin.LowPart = littleBit; +- double elapsed = static_cast<double>(lEnd.QuadPart - lBegin.QuadPart); ++ const double elapsed = static_cast<double>(lEnd.QuadPart - lBegin.QuadPart); + result = elapsed / static_cast<double>(frequency.QuadPart); + } else { + endBigBit = clock(); + endLittleBit = 0; +- double elapsed = endBigBit - bigBit; ++ const double elapsed = endBigBit - bigBit; + result = elapsed / CLOCKS_PER_SEC; + } + if (reset) { +@@ -3036,7 +3036,7 @@ + + bool Platform::IsDBCSLeadByte(int codePage, char ch) { + // Byte ranges found in Wikipedia articles with relevant search strings in each case +- unsigned char uch = static_cast<unsigned char>(ch); ++ const unsigned char uch = static_cast<unsigned char>(ch); + switch (codePage) { + case 932: + // Shift_jis +@@ -3109,7 +3109,7 @@ + static bool assertionPopUps = true; + + bool Platform::ShowAssertionPopUps(bool assertionPopUps_) { +- bool ret = assertionPopUps; ++ const bool ret = assertionPopUps; + assertionPopUps = assertionPopUps_; + return ret; + } +@@ -3118,7 +3118,7 @@ + char buffer[2000]; + sprintf(buffer, "Assertion [%s] failed at %s %d%s", c, file, line, assertionPopUps ? "" : "\r\n"); + if (assertionPopUps) { +- int idButton = ::MessageBoxA(0, buffer, "Assertion failure", ++ const int idButton = ::MessageBoxA(0, buffer, "Assertion failure", + MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); + if (idButton == IDRETRY) { + ::DebugBreak(); +diff -r 797ed6c538fd -r d046ce80d590 win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Thu Apr 06 20:19:23 2017 +1000 ++++ b/win32/ScintillaWin.cxx Thu Apr 06 21:04:37 2017 +1000 +@@ -594,8 +594,8 @@ + } + + bool ScintillaWin::DragThreshold(Point ptStart, Point ptNow) { +- int xMove = static_cast<int>(std::abs(ptStart.x - ptNow.x)); +- int yMove = static_cast<int>(std::abs(ptStart.y - ptNow.y)); ++ const int xMove = static_cast<int>(std::abs(ptStart.x - ptNow.x)); ++ const int yMove = static_cast<int>(std::abs(ptStart.y - ptNow.y)); + return (xMove > ::GetSystemMetrics(SM_CXDRAG)) || + (yMove > ::GetSystemMetrics(SM_CYDRAG)); + } +@@ -607,7 +607,7 @@ + IDataObject *pDataObject = reinterpret_cast<IDataObject *>(&dob); + IDropSource *pDropSource = reinterpret_cast<IDropSource *>(&ds); + //Platform::DebugPrintf("About to DoDragDrop %x %x\n", pDataObject, pDropSource); +- HRESULT hr = ::DoDragDrop( ++ const HRESULT hr = ::DoDragDrop( + pDataObject, + pDropSource, + DROPEFFECT_COPY | DROPEFFECT_MOVE, &dwEffect); +@@ -635,7 +635,7 @@ + HKL inputLocale = ::GetKeyboardLayout(0); + LANGID inputLang = LOWORD(inputLocale); + char sCodePage[10]; +- int res = ::GetLocaleInfoA(MAKELCID(inputLang, SORT_DEFAULT), ++ const int res = ::GetLocaleInfoA(MAKELCID(inputLang, SORT_DEFAULT), + LOCALE_IDEFAULTANSICODEPAGE, sCodePage, sizeof(sCodePage)); + if (!res) + return 0; +@@ -687,7 +687,7 @@ + if (hRgnCheck) { + HRGN hRgnDifference = ::CreateRectRgn(0, 0, 0, 0); + if (hRgnDifference) { +- int combination = ::CombineRgn(hRgnDifference, hRgnCheck, hRgnBounds, RGN_DIFF); ++ const int combination = ::CombineRgn(hRgnDifference, hRgnCheck, hRgnBounds, RGN_DIFF); + if (combination != NULLREGION) { + contains = false; + } +@@ -788,7 +788,7 @@ + } else { + UINT cpDest = CodePageOfDocument(); + char inBufferCP[maxLenInputIME * 2]; +- int size = ::WideCharToMultiByte(cpDest, ++ const int size = ::WideCharToMultiByte(cpDest, + 0, wcs, wclen, inBufferCP, sizeof(inBufferCP) - 1, 0, 0); + for (int i=0; i<size; i++) { + AddChar(inBufferCP[i]); +@@ -800,12 +800,12 @@ + //ElapsedTime et; + + // Redirect assertions to debug output and save current state +- bool assertsPopup = Platform::ShowAssertionPopUps(false); ++ const bool assertsPopup = Platform::ShowAssertionPopUps(false); + paintState = painting; + PAINTSTRUCT ps; + PAINTSTRUCT *pps; + +- bool IsOcxCtrl = (wParam != 0); // if wParam != 0, it contains ++ const bool IsOcxCtrl = (wParam != 0); // if wParam != 0, it contains + // a PAINSTRUCT* from the OCX + // Removed since this interferes with reporting other assertions as it occurs repeatedly + //PLATFORM_ASSERT(hRgnUpdate == NULL); +@@ -818,7 +818,7 @@ + ::BeginPaint(MainHWND(), pps); + } + rcPaint = PRectangle::FromInts(pps->rcPaint.left, pps->rcPaint.top, pps->rcPaint.right, pps->rcPaint.bottom); +- PRectangle rcClient = GetClientRectangle(); ++ const PRectangle rcClient = GetClientRectangle(); + paintingAllText = BoundsContains(rcPaint, hRgnUpdate, rcClient); + if (technology == SC_TECHNOLOGY_DEFAULT) { + AutoSurface surfaceWindow(pps->hdc, this); +@@ -834,7 +834,7 @@ + pRenderTarget->BeginDraw(); + Paint(surfaceWindow, rcPaint); + surfaceWindow->Release(); +- HRESULT hr = pRenderTarget->EndDraw(); ++ const HRESULT hr = pRenderTarget->EndDraw(); + if (hr == static_cast<HRESULT>(D2DERR_RECREATE_TARGET)) { + DropRenderTarget(); + paintState = paintAbandoned; +@@ -939,7 +939,7 @@ + pdoc->GetCharRange(&documentStr[0], selStart, documentStrLen); + + std::wstring uniStr = StringDecode(documentStr, CodePageOfDocument()); +- int converted = HanjaDict::GetHangulOfHanja(&uniStr[0]); ++ const int converted = HanjaDict::GetHangulOfHanja(&uniStr[0]); + documentStr = StringEncode(uniStr, CodePageOfDocument()); + + if (converted > 0) { +@@ -1028,7 +1028,7 @@ + if (wcs.empty()) + return; + +- int codePage = CodePageOfDocument(); ++ const int codePage = CodePageOfDocument(); + for (size_t i = 0; i < wcs.size(); ) { + const size_t ucWidth = UTF16CharLength(wcs[i]); + const std::wstring uniChar(wcs, i, ucWidth); +@@ -1075,9 +1075,9 @@ + + std::vector<int> imeIndicator = MapImeIndicators(imc.GetImeAttributes()); + +- bool tmpRecordingMacro = recordingMacro; ++ const bool tmpRecordingMacro = recordingMacro; + recordingMacro = false; +- int codePage = CodePageOfDocument(); ++ const int codePage = CodePageOfDocument(); + for (size_t i = 0; i < wcs.size(); ) { + const size_t ucWidth = UTF16CharLength(wcs[i]); + const std::wstring uniChar(wcs, i, ucWidth); +@@ -1091,7 +1091,7 @@ + recordingMacro = tmpRecordingMacro; + + // Move IME caret from current last position to imeCaretPos. +- int imeEndToImeCaretU16 = imc.GetImeCaretPos() - static_cast<unsigned int>(wcs.size()); ++ const int imeEndToImeCaretU16 = imc.GetImeCaretPos() - static_cast<unsigned int>(wcs.size()); + Sci::Position imeCaretPosDoc = pdoc->GetRelativePositionUTF16(CurrentPosition(), imeEndToImeCaretU16); + + MoveImeCarets(- CurrentPosition() + imeCaretPosDoc); +@@ -1352,8 +1352,8 @@ + #ifdef _MSC_VER + #pragma warning(suppress: 28159) + #endif +- DWORD dwCurrent = GetTickCount(); +- DWORD dwStart = wParam ? static_cast<DWORD>(wParam) : dwCurrent; ++ const DWORD dwCurrent = GetTickCount(); ++ const DWORD dwStart = wParam ? static_cast<DWORD>(wParam) : dwCurrent; + const DWORD maxWorkTime = 50; + + if (dwCurrent >= dwStart && dwCurrent > maxWorkTime && dwCurrent - maxWorkTime < dwStart) +@@ -1484,7 +1484,7 @@ + case WM_KEYDOWN: { + //Platform::DebugPrintf("S keydown %d %x %x %x %x\n",iMessage, wParam, lParam, ::IsKeyDown(VK_SHIFT), ::IsKeyDown(VK_CONTROL)); + lastKeyDownConsumed = false; +- int ret = KeyDown(KeyTranslate(static_cast<int>(wParam)), ++ const int ret = KeyDown(KeyTranslate(static_cast<int>(wParam)), + Platform::IsKeyDown(VK_SHIFT), + Platform::IsKeyDown(VK_CONTROL), + Platform::IsKeyDown(VK_MENU), +@@ -1526,7 +1526,7 @@ + case WM_KILLFOCUS: { + HWND wOther = reinterpret_cast<HWND>(wParam); + HWND wThis = MainHWND(); +- HWND wCT = static_cast<HWND>(ct.wCallTip.GetID()); ++ const HWND wCT = static_cast<HWND>(ct.wCallTip.GetID()); + if (!wParam || + !(::IsChild(wThis, wOther) || (wOther == wCT))) { + SetFocusState(false); +@@ -1929,7 +1929,7 @@ + modified = true; + } + +- PRectangle rcText = GetTextRectangle(); ++ const PRectangle rcText = GetTextRectangle(); + int horizEndPreferred = scrollWidth; + if (horizEndPreferred < 0) + horizEndPreferred = 0; +@@ -2013,7 +2013,7 @@ + if (lenMixed > utf16Mixed.size()) { + utf16Mixed.resize(lenMixed + 8); + } +- size_t nUtf16Mixed = ::MultiByteToWideChar(cp, 0, mixed, ++ const size_t nUtf16Mixed = ::MultiByteToWideChar(cp, 0, mixed, + static_cast<int>(lenMixed), + &utf16Mixed[0], + static_cast<int>(utf16Mixed.size())); +@@ -2032,7 +2032,7 @@ + if (foldedUTF8) { + // Maximum length of a case conversion is 6 bytes, 3 characters + wchar_t wFolded[20]; +- size_t charsConverted = UTF16FromUTF8(foldedUTF8, ++ const size_t charsConverted = UTF16FromUTF8(foldedUTF8, + strlen(foldedUTF8), + wFolded, ELEMENTS(wFolded)); + for (size_t j=0; j<charsConverted; j++) +@@ -2072,18 +2072,18 @@ + char sCharacter[2] = "A"; + sCharacter[0] = static_cast<char>(i); + wchar_t wCharacter[20]; +- unsigned int lengthUTF16 = ::MultiByteToWideChar(cpDoc, 0, sCharacter, 1, ++ const unsigned int lengthUTF16 = ::MultiByteToWideChar(cpDoc, 0, sCharacter, 1, + wCharacter, ELEMENTS(wCharacter)); + if (lengthUTF16 == 1) { + const char *caseFolded = CaseConvert(wCharacter[0], CaseConversionFold); + if (caseFolded) { + wchar_t wLower[20]; +- size_t charsConverted = UTF16FromUTF8(caseFolded, ++ const size_t charsConverted = UTF16FromUTF8(caseFolded, + strlen(caseFolded), + wLower, ELEMENTS(wLower)); + if (charsConverted == 1) { + char sCharacterLowered[20]; +- unsigned int lengthConverted = ::WideCharToMultiByte(cpDoc, 0, ++ const unsigned int lengthConverted = ::WideCharToMultiByte(cpDoc, 0, + wLower, static_cast<int>(charsConverted), + sCharacterLowered, ELEMENTS(sCharacterLowered), NULL, 0); + if ((lengthConverted == 1) && (sCharacter[0] != sCharacterLowered[0])) { +@@ -2234,7 +2234,7 @@ + std::vector<char> putf; + // Default Scintilla behaviour in Unicode mode + if (IsUnicodeMode()) { +- unsigned int bytes = static_cast<unsigned int>(memUSelection.Size()); ++ const unsigned int bytes = static_cast<unsigned int>(memUSelection.Size()); + len = UTF8Length(uptr, bytes / 2); + putf.resize(len + 1); + UTF8FromUTF16(uptr, bytes / 2, &putf[0], len); +@@ -2258,7 +2258,7 @@ + if (memSelection) { + char *ptr = static_cast<char *>(memSelection.ptr); + if (ptr) { +- unsigned int bytes = static_cast<unsigned int>(memSelection.Size()); ++ const unsigned int bytes = static_cast<unsigned int>(memSelection.Size()); + unsigned int len = bytes; + for (unsigned int i = 0; i < bytes; i++) { + if ((len == bytes) && (0 == ptr[i])) +@@ -2269,7 +2269,7 @@ + if (IsUnicodeMode()) { + std::vector<wchar_t> uptr(len+1); + +- unsigned int ulen = ::MultiByteToWideChar(CP_ACP, 0, ++ const unsigned int ulen = ::MultiByteToWideChar(CP_ACP, 0, + ptr, len, &uptr[0], len+1); + + unsigned int mlen = UTF8Length(&uptr[0], ulen); +@@ -2460,7 +2460,7 @@ + return S_OK; + } + +- bool formatOK = (pFE->cfFormat == CF_TEXT) || ++ const bool formatOK = (pFE->cfFormat == CF_TEXT) || + ((pFE->cfFormat == CF_UNICODETEXT) && pd->sci->IsUnicodeMode()); + if (!formatOK || + pFE->ptd != 0 || +@@ -2855,8 +2855,8 @@ + + void ScintillaWin::HorizontalScrollMessage(WPARAM wParam) { + int xPos = xOffset; +- PRectangle rcText = GetTextRectangle(); +- int pageWidth = static_cast<int>(rcText.Width() * 2 / 3); ++ const PRectangle rcText = GetTextRectangle(); ++ const int pageWidth = static_cast<int>(rcText.Width() * 2 / 3); + switch (LoWord(wParam)) { + case SB_LINEUP: + xPos -= 20; +@@ -2930,7 +2930,7 @@ + pRenderTarget->BeginDraw(); + Paint(surfaceWindow, rcPaint); + surfaceWindow->Release(); +- HRESULT hr = pRenderTarget->EndDraw(); ++ const HRESULT hr = pRenderTarget->EndDraw(); + if (hr == static_cast<HRESULT>(D2DERR_RECREATE_TARGET)) { + DropRenderTarget(); + } +@@ -2946,7 +2946,7 @@ + + bool ScintillaWin::IsCompatibleDC(HDC hOtherDC) { + HDC hdc = ::GetDC(MainHWND()); +- bool isCompatible = ++ const bool isCompatible = + CompareDevCap(hdc, hOtherDC, TECHNOLOGY) && + CompareDevCap(hdc, hOtherDC, LOGPIXELSY) && + CompareDevCap(hdc, hOtherDC, LOGPIXELSX) && +@@ -3000,11 +3000,11 @@ + if (pIDataSource == NULL) + return E_POINTER; + FORMATETC fmtu = {CF_UNICODETEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; +- HRESULT hrHasUText = pIDataSource->QueryGetData(&fmtu); ++ const HRESULT hrHasUText = pIDataSource->QueryGetData(&fmtu); + hasOKText = (hrHasUText == S_OK); + if (!hasOKText) { + FORMATETC fmte = {CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; +- HRESULT hrHasText = pIDataSource->QueryGetData(&fmte); ++ const HRESULT hrHasText = pIDataSource->QueryGetData(&fmte); + hasOKText = (hrHasText == S_OK); + } + if (!hasOKText) { +@@ -3068,7 +3068,7 @@ + wchar_t *udata = static_cast<wchar_t *>(memUDrop.ptr); + if (udata) { + if (IsUnicodeMode()) { +- int tlen = static_cast<int>(memUDrop.Size()); ++ const int tlen = static_cast<int>(memUDrop.Size()); + // Convert UTF-16 to UTF-8 + int dataLen = UTF8Length(udata, tlen/2); + data.resize(dataLen+1); +@@ -3129,7 +3129,7 @@ + + /// Implement important part of IDataObject + STDMETHODIMP ScintillaWin::GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM) { +- bool formatOK = (pFEIn->cfFormat == CF_TEXT) || ++ const bool formatOK = (pFEIn->cfFormat == CF_TEXT) || + ((pFEIn->cfFormat == CF_UNICODETEXT) && IsUnicodeMode()); + if (!formatOK || + pFEIn->ptd != 0 || +@@ -3421,7 +3421,7 @@ + // Must be called once only. + int Scintilla_RegisterClasses(void *hInstance) { + Platform_Initialise(hInstance); +- bool result = ScintillaWin::Register(static_cast<HINSTANCE>(hInstance)); ++ const bool result = ScintillaWin::Register(static_cast<HINSTANCE>(hInstance)); + #ifdef SCI_LEXER + Scintilla_LinkLexers(); + #endif +@@ -3429,7 +3429,7 @@ + } + + static int ResourcesRelease(bool fromDllMain) { +- bool result = ScintillaWin::Unregister(); ++ const bool result = ScintillaWin::Unregister(); + Platform_Finalise(fromDllMain); + return result; + } diff --git a/src/scintilla_backports/6170_df221375187c.patch b/src/scintilla_backports/6170_df221375187c.patch new file mode 100644 index 00000000..28479b0a --- /dev/null +++ b/src/scintilla_backports/6170_df221375187c.patch @@ -0,0 +1,25 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491548892 -36000 +# Node ID df221375187cab18a3e1c73ae83fa46805bf98db +# Parent ef932abba46c57933959a83bd63fafc429d35259 +Allowing assigning Windows and ensure cursorLast is initialized. + +diff -r ef932abba46c -r df221375187c include/Platform.h +--- a/include/Platform.h Thu Apr 06 21:04:52 2017 +1000 ++++ b/include/Platform.h Fri Apr 07 17:08:12 2017 +1000 +@@ -363,6 +363,14 @@ + virtual ~Window(); + Window &operator=(WindowID wid_) { + wid = wid_; ++ cursorLast = cursorInvalid; ++ return *this; ++ } ++ Window &operator=(const Window &other) { ++ if (this != &other) { ++ wid = other.wid; ++ cursorLast = other.cursorLast; ++ } + return *this; + } + WindowID GetID() const { return wid; } diff --git a/src/scintilla_backports/6171_99e46ea84433.patch b/src/scintilla_backports/6171_99e46ea84433.patch new file mode 100644 index 00000000..4b183244 --- /dev/null +++ b/src/scintilla_backports/6171_99e46ea84433.patch @@ -0,0 +1,25 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491548935 -36000 +# Node ID 99e46ea84433f95e568fb9fdc7d4a92869e823ab +# Parent df221375187cab18a3e1c73ae83fa46805bf98db +Check index before checking value at index. + +diff -r df221375187c -r 99e46ea84433 src/CellBuffer.cxx +--- a/src/CellBuffer.cxx Fri Apr 07 17:08:12 2017 +1000 ++++ b/src/CellBuffer.cxx Fri Apr 07 17:08:55 2017 +1000 +@@ -348,12 +348,12 @@ + + int UndoHistory::StartRedo() { + // Drop any leading startAction +- if (actions[currentAction].at == startAction && currentAction < maxAction) ++ if (currentAction < maxAction && actions[currentAction].at == startAction) + currentAction++; + + // Count the steps in this action + int act = currentAction; +- while (actions[act].at != startAction && act < maxAction) { ++ while (act < maxAction && actions[act].at != startAction) { + act++; + } + return act - currentAction; diff --git a/src/scintilla_backports/6172_84161436cfbc.patch b/src/scintilla_backports/6172_84161436cfbc.patch new file mode 100644 index 00000000..8ee2d3b6 --- /dev/null +++ b/src/scintilla_backports/6172_84161436cfbc.patch @@ -0,0 +1,491 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491550081 -36000 +# Node ID 84161436cfbc309da3b30e6fe5bc69c0a9331cfa +# Parent 99e46ea84433f95e568fb9fdc7d4a92869e823ab +Use same parameter names in declarations and definitions. + +diff -r 99e46ea84433 -r 84161436cfbc gtk/PlatGTK.cxx +--- a/gtk/PlatGTK.cxx Fri Apr 07 17:08:55 2017 +1000 ++++ b/gtk/PlatGTK.cxx Fri Apr 07 17:28:01 2017 +1000 +@@ -1505,13 +1505,13 @@ + GTK_WINDOW(top)); + } + +-void ListBoxX::SetFont(Font &scint_font) { ++void ListBoxX::SetFont(Font &font) { + // Only do for Pango font as there have been crashes for GDK fonts +- if (Created() && PFont(scint_font)->pfd) { ++ if (Created() && PFont(font)->pfd) { + // Current font is Pango font + #if GTK_CHECK_VERSION(3,0,0) + if (cssProvider) { +- PangoFontDescription *pfd = PFont(scint_font)->pfd; ++ PangoFontDescription *pfd = PFont(font)->pfd; + std::ostringstream ssFontSetting; + ssFontSetting << "GtkTreeView, treeview { "; + ssFontSetting << "font-family: " << pango_font_description_get_family(pfd) << "; "; +@@ -1532,7 +1532,7 @@ + ssFontSetting.str().c_str(), -1, NULL); + } + #else +- gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd); ++ gtk_widget_modify_font(PWidget(list), PFont(font)->pfd); + #endif + gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(renderer), -1); + gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(renderer), 1); +@@ -1918,14 +1918,14 @@ + } + #endif + +-void Menu::Show(Point pt, Window &wnd) { ++void Menu::Show(Point pt, Window &w) { + GtkMenu *widget = static_cast<GtkMenu *>(mid); + gtk_widget_show_all(GTK_WIDGET(widget)); + #if GTK_CHECK_VERSION(3,22,0) + // Rely on GTK+ to do the right thing with positioning + gtk_menu_popup_at_pointer(widget, NULL); + #else +- GdkRectangle rcMonitor = MonitorRectangleForWidget(PWidget(wnd.GetID())); ++ GdkRectangle rcMonitor = MonitorRectangleForWidget(PWidget(w.GetID())); + GtkRequisition requisition; + #if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_preferred_size(GTK_WIDGET(widget), NULL, &requisition); +diff -r 99e46ea84433 -r 84161436cfbc gtk/ScintillaGTK.h +--- a/gtk/ScintillaGTK.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/gtk/ScintillaGTK.h Fri Apr 07 17:28:01 2017 +1000 +@@ -135,7 +135,7 @@ + void GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText); + void ReceivedSelection(GtkSelectionData *selection_data); + void ReceivedDrop(GtkSelectionData *selection_data); +- static void GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *selected); ++ static void GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *text); + void StoreOnClipboard(SelectionText *clipText); + static void ClipboardGetSelection(GtkClipboard* clip, GtkSelectionData *selection_data, guint info, void *data); + static void ClipboardClearSelection(GtkClipboard* clip, void *data); +@@ -197,7 +197,7 @@ + static AtkObject* GetAccessible(GtkWidget *widget); + + bool KoreanIME(); +- void CommitThis(char *str); ++ void CommitThis(char *commitStr); + static void Commit(GtkIMContext *context, char *str, ScintillaGTK *sciThis); + void PreeditChangedInlineThis(); + void PreeditChangedWindowedThis(); +@@ -238,7 +238,7 @@ + #if GTK_CHECK_VERSION(3,0,0) + static gboolean DrawCT(GtkWidget *widget, cairo_t *cr, CallTip *ctip); + #else +- static gboolean ExposeCT(GtkWidget *widget, GdkEventExpose *ose, CallTip *ct); ++ static gboolean ExposeCT(GtkWidget *widget, GdkEventExpose *ose, CallTip *ctip); + #endif + static gboolean PressCT(GtkWidget *widget, GdkEventButton *event, ScintillaGTK *sciThis); + +diff -r 99e46ea84433 -r 84161436cfbc gtk/ScintillaGTKAccessible.h +--- a/gtk/ScintillaGTKAccessible.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/gtk/ScintillaGTKAccessible.h Fri Apr 07 17:28:01 2017 +1000 +@@ -109,7 +109,7 @@ + gboolean SetCaretOffset(int charOffset); + gint GetOffsetAtPoint(gint x, gint y, AtkCoordType coords); + void GetCharacterExtents(int charOffset, gint *x, gint *y, gint *width, gint *height, AtkCoordType coords); +- AtkAttributeSet *GetAttributesForStyle(unsigned int style); ++ AtkAttributeSet *GetAttributesForStyle(unsigned int styleNum); + AtkAttributeSet *GetRunAttributes(int charOffset, int *startChar, int *endChar); + AtkAttributeSet *GetDefaultAttributes(); + gint GetNSelections(); +@@ -120,14 +120,14 @@ + // for AtkEditableText + bool InsertStringUTF8(Sci::Position bytePos, const gchar *utf8, Sci::Position lengthBytes); + void SetTextContents(const gchar *contents); +- void InsertText(const gchar *contents, int lengthBytes, int *charPosition); ++ void InsertText(const gchar *text, int lengthBytes, int *charPosition); + void CopyText(int startChar, int endChar); + void CutText(int startChar, int endChar); + void DeleteText(int startChar, int endChar); + void PasteText(int charPosition); + + public: +- ScintillaGTKAccessible(GtkAccessible *accessible, GtkWidget *widget); ++ ScintillaGTKAccessible(GtkAccessible *accessible_, GtkWidget *widget_); + ~ScintillaGTKAccessible(); + + static ScintillaGTKAccessible *FromAccessible(GtkAccessible *accessible); +diff -r 99e46ea84433 -r 84161436cfbc lexlib/LexerModule.h +--- a/lexlib/LexerModule.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/lexlib/LexerModule.h Fri Apr 07 17:28:01 2017 +1000 +@@ -53,9 +53,9 @@ + + ILexer *Create() const; + +- virtual void Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, ++ virtual void Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const; +- virtual void Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, ++ virtual void Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const; + + friend class Catalogue; +diff -r 99e46ea84433 -r 84161436cfbc lexlib/LexerNoExceptions.cxx +--- a/lexlib/LexerNoExceptions.cxx Fri Apr 07 17:08:55 2017 +1000 ++++ b/lexlib/LexerNoExceptions.cxx Fri Apr 07 17:28:01 2017 +1000 +@@ -42,20 +42,20 @@ + return -1; + } + +-void SCI_METHOD LexerNoExceptions::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { ++void SCI_METHOD LexerNoExceptions::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { + try { + Accessor astyler(pAccess, &props); +- Lexer(startPos, length, initStyle, pAccess, astyler); ++ Lexer(startPos, lengthDoc, initStyle, pAccess, astyler); + astyler.Flush(); + } catch (...) { + // Should not throw into caller as may be compiled with different compiler or options + pAccess->SetErrorStatus(SC_STATUS_FAILURE); + } + } +-void SCI_METHOD LexerNoExceptions::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { ++void SCI_METHOD LexerNoExceptions::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { + try { + Accessor astyler(pAccess, &props); +- Folder(startPos, length, initStyle, pAccess, astyler); ++ Folder(startPos, lengthDoc, initStyle, pAccess, astyler); + astyler.Flush(); + } catch (...) { + // Should not throw into caller as may be compiled with different compiler or options +diff -r 99e46ea84433 -r 84161436cfbc qt/ScintillaEditBase/PlatQt.cpp +--- a/qt/ScintillaEditBase/PlatQt.cpp Fri Apr 07 17:08:55 2017 +1000 ++++ b/qt/ScintillaEditBase/PlatQt.cpp Fri Apr 07 17:28:01 2017 +1000 +@@ -755,7 +755,7 @@ + + virtual void SetFont(Font &font); + virtual void Create(Window &parent, int ctrlID, Point location, +- int lineHeight, bool unicodeMode, int technology); ++ int lineHeight, bool unicodeMode_, int technology); + virtual void SetAverageCharWidth(int width); + virtual void SetVisibleRows(int rows); + virtual int GetVisibleRows() const; +diff -r 99e46ea84433 -r 84161436cfbc qt/ScintillaEditBase/PlatQt.h +--- a/qt/ScintillaEditBase/PlatQt.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/qt/ScintillaEditBase/PlatQt.h Fri Apr 07 17:28:01 2017 +1000 +@@ -75,8 +75,8 @@ + virtual void PenColour(ColourDesired fore); + virtual int LogPixelsY(); + virtual int DeviceHeightFont(int points); +- virtual void MoveTo(int x, int y); +- virtual void LineTo(int x, int y); ++ virtual void MoveTo(int x_, int y_); ++ virtual void LineTo(int x_, int y_); + virtual void Polygon(Point *pts, int npts, ColourDesired fore, + ColourDesired back); + virtual void RectangleDraw(PRectangle rc, ColourDesired fore, +@@ -85,7 +85,7 @@ + virtual void FillRectangle(PRectangle rc, Surface &surfacePattern); + virtual void RoundedRectangle(PRectangle rc, ColourDesired fore, + ColourDesired back); +- virtual void AlphaRectangle(PRectangle rc, int corner, ColourDesired fill, ++ virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, + int alphaFill, ColourDesired outline, int alphaOutline, int flags); + virtual void DrawRGBAImage(PRectangle rc, int width, int height, + const unsigned char *pixelsImage); +@@ -113,8 +113,8 @@ + virtual void SetClip(PRectangle rc); + virtual void FlushCachedState(); + +- virtual void SetUnicodeMode(bool unicodeMode); +- virtual void SetDBCSMode(int codePage); ++ virtual void SetUnicodeMode(bool unicodeMode_); ++ virtual void SetDBCSMode(int codePage_); + + void BrushColour(ColourDesired back); + void SetCodec(Font &font); +diff -r 99e46ea84433 -r 84161436cfbc qt/ScintillaEditBase/ScintillaQt.cpp +--- a/qt/ScintillaEditBase/ScintillaQt.cpp Fri Apr 07 17:08:55 2017 +1000 ++++ b/qt/ScintillaEditBase/ScintillaQt.cpp Fri Apr 07 17:28:01 2017 +1000 +@@ -648,10 +648,10 @@ + this, SLOT(execCommand(QAction *))); + } + +-sptr_t ScintillaQt::WndProc(unsigned int message, uptr_t wParam, sptr_t lParam) ++sptr_t ScintillaQt::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) + { + try { +- switch (message) { ++ switch (iMessage) { + + case SCI_SETIMEINTERACTION: + // Only inline IME supported on Qt +@@ -674,7 +674,7 @@ + #endif + + default: +- return ScintillaBase::WndProc(message, wParam, lParam); ++ return ScintillaBase::WndProc(iMessage, wParam, lParam); + } + } catch (std::bad_alloc &) { + errorStatus = SC_STATUS_BADALLOC; +diff -r 99e46ea84433 -r 84161436cfbc src/CallTip.h +--- a/src/CallTip.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/CallTip.h Fri Apr 07 17:28:01 2017 +1000 +@@ -34,7 +34,7 @@ + int posStart, int posEnd, int ytext, PRectangle rcClient, + bool highlight, bool draw); + int PaintContents(Surface *surfaceWindow, bool draw); +- bool IsTabCharacter(char c) const; ++ bool IsTabCharacter(char ch) const; + int NextTabPos(int x) const; + + public: +diff -r 99e46ea84433 -r 84161436cfbc src/CellBuffer.h +--- a/src/CellBuffer.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/CellBuffer.h Fri Apr 07 17:28:01 2017 +1000 +@@ -90,7 +90,7 @@ + UndoHistory(); + ~UndoHistory(); + +- const char *AppendAction(actionType at, Sci::Position position, const char *data, Sci::Position length, bool &startSequence, bool mayCoalesce=true); ++ const char *AppendAction(actionType at, Sci::Position position, const char *data, Sci::Position lengthData, bool &startSequence, bool mayCoalesce=true); + + void BeginUndoAction(); + void EndUndoAction(); +@@ -173,7 +173,7 @@ + /// Setting styles for positions outside the range of the buffer is safe and has no effect. + /// @return true if the style of a character is changed. + bool SetStyleAt(Sci::Position position, char styleValue); +- bool SetStyleFor(Sci::Position position, Sci::Position length, char styleValue); ++ bool SetStyleFor(Sci::Position position, Sci::Position lengthStyle, char styleValue); + + const char *DeleteChars(Sci::Position position, Sci::Position deleteLength, bool &startSequence); + +diff -r 99e46ea84433 -r 84161436cfbc src/CharClassify.h +--- a/src/CharClassify.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/CharClassify.h Fri Apr 07 17:28:01 2017 +1000 +@@ -19,7 +19,7 @@ + enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation }; + void SetDefaultCharClasses(bool includeWordClass); + void SetCharClasses(const unsigned char *chars, cc newCharClass); +- int GetCharsOfClass(cc charClass, unsigned char *buffer) const; ++ int GetCharsOfClass(cc characterClass, unsigned char *buffer) const; + cc GetClass(unsigned char ch) const { return static_cast<cc>(charClass[ch]);} + bool IsWord(unsigned char ch) const { return static_cast<cc>(charClass[ch]) == ccWord;} + +diff -r 99e46ea84433 -r 84161436cfbc src/Document.h +--- a/src/Document.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/Document.h Fri Apr 07 17:28:01 2017 +1000 +@@ -334,7 +334,7 @@ + int SCI_METHOD GetLineIndentation(Sci_Position line); + Sci::Position SetLineIndentation(Sci::Line line, Sci::Position indent); + Sci::Position GetLineIndentPosition(Sci::Line line) const; +- Sci::Position GetColumn(Sci::Position position); ++ Sci::Position GetColumn(Sci::Position pos); + Sci::Position CountCharacters(Sci::Position startPos, Sci::Position endPos) const; + Sci::Position CountUTF16(Sci::Position startPos, Sci::Position endPos) const; + Sci::Position FindColumn(Sci::Line line, Sci::Position column); +@@ -377,7 +377,7 @@ + void ClearLevels(); + Sci::Line GetLastChild(Sci::Line lineParent, int level=-1, Sci::Line lastLine=-1); + Sci::Line GetFoldParent(Sci::Line line) const; +- void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, Sci::Line line, Sci::Line lastLine); ++ void GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, Sci::Line line, Sci::Line lastLine); + + Sci::Position ExtendWordSelect(Sci::Position pos, int delta, bool onlyWordCharacters=false) const; + Sci::Position NextWordStart(Sci::Position pos, int delta) const; +diff -r 99e46ea84433 -r 84161436cfbc src/EditView.h +--- a/src/EditView.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/EditView.h Fri Apr 07 17:28:01 2017 +1000 +@@ -128,7 +128,7 @@ + Sci::Line line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase); + void DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + Sci::Line line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase); +- void DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line line, ++ void DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line lineDoc, + int xStart, PRectangle rcLine, int subLine) const; + void DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, + Range lineRange, Sci::Position posLineStart, int xStart, +diff -r 99e46ea84433 -r 84161436cfbc src/Editor.cxx +--- a/src/Editor.cxx Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/Editor.cxx Fri Apr 07 17:28:01 2017 +1000 +@@ -1627,18 +1627,18 @@ + } + } + +-void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { ++void Editor::PaintSelMargin(Surface *surfaceWindow, PRectangle &rc) { + if (vs.fixedColumnWidth == 0) + return; + + AllocateGraphics(); + RefreshStyleData(); +- RefreshPixMaps(surfWindow); ++ RefreshPixMaps(surfaceWindow); + + // On GTK+ with Ubuntu overlay scroll bars, the surface may have been finished + // at this point. The Initialised call checks for this case and sets the status + // to be bad which avoids crashes in following calls. +- if (!surfWindow->Initialised()) { ++ if (!surfaceWindow->Initialised()) { + return; + } + +@@ -1655,7 +1655,7 @@ + if (view.bufferedDraw) { + surface = marginView.pixmapSelMargin; + } else { +- surface = surfWindow; ++ surface = surfaceWindow; + } + + // Clip vertically to paint area to avoid drawing line numbers +@@ -1667,7 +1667,7 @@ + marginView.PaintMargin(surface, topLine, rc, rcMargin, *this, vs); + + if (view.bufferedDraw) { +- surfWindow->Copy(rcMargin, Point(rcMargin.left, rcMargin.top), *marginView.pixmapSelMargin); ++ surfaceWindow->Copy(rcMargin, Point(rcMargin.left, rcMargin.top), *marginView.pixmapSelMargin); + } + } + +diff -r 99e46ea84433 -r 84161436cfbc src/Editor.h +--- a/src/Editor.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/Editor.h Fri Apr 07 17:28:01 2017 +1000 +@@ -292,7 +292,7 @@ + SelectionPosition SPositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false, bool virtualSpace=true); + Sci::Position PositionFromLocation(Point pt, bool canReturnInvalid = false, bool charPosition = false); + SelectionPosition SPositionFromLineX(Sci::Line lineDoc, int x); +- Sci::Position PositionFromLineX(Sci::Line line, int x); ++ Sci::Position PositionFromLineX(Sci::Line lineDoc, int x); + Sci::Line LineFromLocation(Point pt) const; + void SetTopLine(Sci::Line topLineNew); + +@@ -377,7 +377,7 @@ + void LinesJoin(); + void LinesSplit(int pixelWidth); + +- void PaintSelMargin(Surface *surface, PRectangle &rc); ++ void PaintSelMargin(Surface *surfaceWindow, PRectangle &rc); + void RefreshPixMaps(Surface *surfaceWindow); + void Paint(Surface *surfaceWindow, PRectangle rcArea); + long FormatRange(bool draw, Sci_RangeToFormat *pfr); +@@ -449,7 +449,7 @@ + void CheckModificationForWrap(DocModification mh); + void NotifyModified(Document *document, DocModification mh, void *userData); + void NotifyDeleted(Document *document, void *userData); +- void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos); ++ void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endStyleNeeded); + void NotifyLexerChanged(Document *doc, void *userData); + void NotifyErrorOccurred(Document *doc, void *userData, int status); + void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); +diff -r 99e46ea84433 -r 84161436cfbc src/LineMarker.h +--- a/src/LineMarker.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/LineMarker.h Fri Apr 07 17:28:01 2017 +1000 +@@ -76,7 +76,7 @@ + void SetXPM(const char *textForm); + void SetXPM(const char *const *linesForm); + void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); +- void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const; ++ void Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const; + }; + + #ifdef SCI_NAMESPACE +diff -r 99e46ea84433 -r 84161436cfbc src/PerLine.h +--- a/src/PerLine.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/PerLine.h Fri Apr 07 17:28:01 2017 +1000 +@@ -54,7 +54,7 @@ + + int MarkValue(Sci::Line line); + Sci::Line MarkerNext(Sci::Line lineStart, int mask) const; +- int AddMark(Sci::Line line, int marker, Sci::Line lines); ++ int AddMark(Sci::Line line, int markerNum, Sci::Line lines); + void MergeMarkers(Sci::Line line); + bool DeleteMark(Sci::Line line, int markerNum, bool all); + void DeleteMarkFromHandle(int markerHandle); +diff -r 99e46ea84433 -r 84161436cfbc src/PositionCache.h +--- a/src/PositionCache.h Fri Apr 07 17:08:55 2017 +1000 ++++ b/src/PositionCache.h Fri Apr 07 17:28:01 2017 +1000 +@@ -83,7 +83,7 @@ + void Invalidate(validLevel validity_); + int LineStart(int line) const; + int LineLastVisible(int line) const; +- Range SubLineRange(int line) const; ++ Range SubLineRange(int subLine) const; + bool InLine(int offset, int line) const; + void SetLineStart(int line, int start); + void SetBracesHighlight(Range rangeLine, const Sci::Position braces[], +@@ -134,7 +134,7 @@ + void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock_); + void Clear(); + bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const; +- static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len); ++ static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len_); + bool NewerThan(const PositionCacheEntry &other) const; + void ResetClock(); + }; +@@ -194,7 +194,7 @@ + enum { lengthStartSubdivision = 300 }; + // Try to make each subdivided run lengthEachSubdivision or shorter. + enum { lengthEachSubdivision = 100 }; +- BreakFinder(const LineLayout *ll_, const Selection *psel, Range rangeLine_, Sci::Position posLineStart_, ++ BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, Sci::Position posLineStart_, + int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); + ~BreakFinder(); + TextSegment Next(); +diff -r 99e46ea84433 -r 84161436cfbc win32/PlatWin.cxx +--- a/win32/PlatWin.cxx Fri Apr 07 17:08:55 2017 +1000 ++++ b/win32/PlatWin.cxx Fri Apr 07 17:28:01 2017 +1000 +@@ -1811,11 +1811,11 @@ + return rc; + } + +-void Window::SetPositionRelative(PRectangle rc, Window w) { ++void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { + const LONG style = ::GetWindowLong(static_cast<HWND>(wid), GWL_STYLE); + if (style & WS_POPUP) { + POINT ptOther = {0, 0}; +- ::ClientToScreen(static_cast<HWND>(w.GetID()), &ptOther); ++ ::ClientToScreen(static_cast<HWND>(relativeTo.GetID()), &ptOther); + rc.Move(static_cast<XYPOSITION>(ptOther.x), static_cast<XYPOSITION>(ptOther.y)); + + RECT rcMonitor = RectFromPRectangle(rc); +@@ -2657,9 +2657,9 @@ + ::DeleteObject(hBitmap); + } + +-LRESULT PASCAL ListBoxX::ControlWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { ++LRESULT PASCAL ListBoxX::ControlWndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { + try { +- switch (uMsg) { ++ switch (iMessage) { + case WM_ERASEBKGND: + return TRUE; + +@@ -2706,13 +2706,13 @@ + + WNDPROC prevWndProc = reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWLP_USERDATA)); + if (prevWndProc) { +- return ::CallWindowProc(prevWndProc, hWnd, uMsg, wParam, lParam); ++ return ::CallWindowProc(prevWndProc, hWnd, iMessage, wParam, lParam); + } else { +- return ::DefWindowProc(hWnd, uMsg, wParam, lParam); ++ return ::DefWindowProc(hWnd, iMessage, wParam, lParam); + } + } catch (...) { + } +- return ::DefWindowProc(hWnd, uMsg, wParam, lParam); ++ return ::DefWindowProc(hWnd, iMessage, wParam, lParam); + } + + LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { +diff -r 99e46ea84433 -r 84161436cfbc win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Fri Apr 07 17:08:55 2017 +1000 ++++ b/win32/ScintillaWin.cxx Fri Apr 07 17:28:01 2017 +1000 +@@ -356,8 +356,8 @@ + void ScrollMessage(WPARAM wParam); + void HorizontalScrollMessage(WPARAM wParam); + void FullPaint(); +- void FullPaintDC(HDC dc); +- bool IsCompatibleDC(HDC dc); ++ void FullPaintDC(HDC hdc); ++ bool IsCompatibleDC(HDC hOtherDC); + DWORD EffectFromState(DWORD grfKeyState) const; + + int SetScrollInfo(int nBar, LPCSCROLLINFO lpsi, BOOL bRedraw); diff --git a/src/scintilla_backports/6173_c9dcde8a91d3.patch b/src/scintilla_backports/6173_c9dcde8a91d3.patch new file mode 100644 index 00000000..bd605934 --- /dev/null +++ b/src/scintilla_backports/6173_c9dcde8a91d3.patch @@ -0,0 +1,23 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491552139 -36000 +# Node ID c9dcde8a91d3c5d9f28ba3a7cead581ff880e818 +# Parent 84161436cfbc309da3b30e6fe5bc69c0a9331cfa +Drop "virtual" from methods that do not need to be virtual. + +diff -r 84161436cfbc -r c9dcde8a91d3 src/Decoration.h +--- a/src/Decoration.h Fri Apr 07 17:28:01 2017 +1000 ++++ b/src/Decoration.h Fri Apr 07 18:02:19 2017 +1000 +@@ -66,10 +66,10 @@ + int Start(int indicator, int position); + int End(int indicator, int position); + +- virtual bool ClickNotified() const { ++ bool ClickNotified() const { + return clickNotified; + } +- virtual void SetClickNotified(bool notified) { ++ void SetClickNotified(bool notified) { + clickNotified = notified; + } + }; diff --git a/src/scintilla_backports/6174_150bdfbe2b5a.patch b/src/scintilla_backports/6174_150bdfbe2b5a.patch new file mode 100644 index 00000000..fda06d5e --- /dev/null +++ b/src/scintilla_backports/6174_150bdfbe2b5a.patch @@ -0,0 +1,28 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491558264 -36000 +# Node ID 150bdfbe2b5a267eb53a67850d478d311ccd34b6 +# Parent c9dcde8a91d3c5d9f28ba3a7cead581ff880e818 +Remove unnecessary casts. + +diff -r c9dcde8a91d3 -r 150bdfbe2b5a src/PositionCache.cxx +--- a/src/PositionCache.cxx Fri Apr 07 18:02:19 2017 +1000 ++++ b/src/PositionCache.cxx Fri Apr 07 19:44:24 2017 +1000 +@@ -575,7 +575,7 @@ + for (unsigned int i=0; i<len; i++) { + positions[i] = positions_[i]; + } +- memcpy(reinterpret_cast<char *>(reinterpret_cast<void *>(positions + len)), s_, len); ++ memcpy(reinterpret_cast<void *>(positions + len), s_, len); + } + } + +@@ -594,7 +594,7 @@ + bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, + unsigned int len_, XYPOSITION *positions_) const { + if ((styleNumber == styleNumber_) && (len == len_) && +- (memcmp(reinterpret_cast<char *>(reinterpret_cast<void *>(positions + len)), s_, len)== 0)) { ++ (memcmp(reinterpret_cast<void *>(positions + len), s_, len)== 0)) { + for (unsigned int i=0; i<len; i++) { + positions_[i] = positions[i]; + } diff --git a/src/scintilla_backports/6175_d742ec177a7e.patch b/src/scintilla_backports/6175_d742ec177a7e.patch new file mode 100644 index 00000000..e7ee3602 --- /dev/null +++ b/src/scintilla_backports/6175_d742ec177a7e.patch @@ -0,0 +1,167 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491558299 -36000 +# Node ID d742ec177a7eab50fa56cf453d32ed211f767365 +# Parent 150bdfbe2b5a267eb53a67850d478d311ccd34b6 +Prefer C++ static cast over C-style casts. + +diff -r 150bdfbe2b5a -r d742ec177a7e include/Platform.h +--- a/include/Platform.h Fri Apr 07 19:44:24 2017 +1000 ++++ b/include/Platform.h Fri Apr 07 19:44:59 2017 +1000 +@@ -78,7 +78,7 @@ + typedef float XYPOSITION; + typedef double XYACCUMULATOR; + inline int RoundXYPosition(XYPOSITION xyPos) { +- return int(xyPos + 0.5); ++ return static_cast<int>(xyPos + 0.5); + } + + // Underlying the implementation of the platform classes are platform specific types. +diff -r 150bdfbe2b5a -r d742ec177a7e lexers/LexCPP.cxx +--- a/lexers/LexCPP.cxx Fri Apr 07 19:44:24 2017 +1000 ++++ b/lexers/LexCPP.cxx Fri Apr 07 19:44:59 2017 +1000 +@@ -54,7 +54,7 @@ + // Putting a space between the '++' post-inc operator and the '+' binary op + // fixes this, and is highly recommended for readability anyway. + bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) { +- Sci_Position pos = (Sci_Position) sc.currentPos; ++ Sci_Position pos = static_cast<Sci_Position>(sc.currentPos); + while (--pos > 0) { + const char ch = styler[pos]; + if (ch == '+' || ch == '-') { +@@ -66,7 +66,7 @@ + + bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) { + // Don't look at styles, so no need to flush. +- Sci_Position pos = (Sci_Position) sc.currentPos; ++ Sci_Position pos = static_cast<Sci_Position>(sc.currentPos); + Sci_Position currentLine = styler.GetLine(pos); + const Sci_Position lineStartPos = styler.LineStart(currentLine); + while (--pos > lineStartPos) { +@@ -145,7 +145,7 @@ + if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { + const int lengthMarker = 50; + char marker[lengthMarker+1]; +- Sci_Position currPos = (Sci_Position) sc.currentPos; ++ Sci_Position currPos = static_cast<Sci_Position>(sc.currentPos); + int i = 0; + while (i < lengthMarker) { + const char ch = styler.SafeGetCharAt(currPos + i); +diff -r 150bdfbe2b5a -r d742ec177a7e lexers/LexPython.cxx +--- a/lexers/LexPython.cxx Fri Apr 07 19:44:24 2017 +1000 ++++ b/lexers/LexPython.cxx Fri Apr 07 19:44:59 2017 +1000 +@@ -435,7 +435,7 @@ + + if (deepestSingleStateIndex != -1) { + sc.SetState(fstringStateStack[deepestSingleStateIndex].state); +- while (fstringStateStack.size() > (unsigned long)deepestSingleStateIndex) { ++ while (fstringStateStack.size() > static_cast<unsigned long>(deepestSingleStateIndex)) { + PopFromStateStack(fstringStateStack, currentFStringExp); + } + } +@@ -714,7 +714,7 @@ + sc.ForwardSetState(SCE_P_DEFAULT); + needEOLCheck = true; + +- while (fstringStateStack.size() > (unsigned long)matching_stack_i) { ++ while (fstringStateStack.size() > static_cast<unsigned long>(matching_stack_i)) { + PopFromStateStack(fstringStateStack, currentFStringExp); + } + } +diff -r 150bdfbe2b5a -r d742ec177a7e src/AutoComplete.cxx +--- a/src/AutoComplete.cxx Fri Apr 07 19:44:24 2017 +1000 ++++ b/src/AutoComplete.cxx Fri Apr 07 19:44:59 2017 +1000 +@@ -156,7 +156,7 @@ + + Sorter IndexSort(this, list); + sortMatrix.clear(); +- for (int i = 0; i < (int)IndexSort.indices.size() / 2; ++i) ++ for (int i = 0; i < static_cast<int>(IndexSort.indices.size()) / 2; ++i) + sortMatrix.push_back(i); + std::sort(sortMatrix.begin(), sortMatrix.end(), IndexSort); + if (autoSort == SC_ORDER_CUSTOM || sortMatrix.size() < 2) { +@@ -186,7 +186,7 @@ + item[wordLen] = '\0'; + sortedList += item; + } +- for (int i = 0; i < (int)sortMatrix.size(); ++i) ++ for (int i = 0; i < static_cast<int>(sortMatrix.size()); ++i) + sortMatrix[i] = i; + lb->SetList(sortedList.c_str(), separator, typesep); + } +diff -r 150bdfbe2b5a -r d742ec177a7e src/Indicator.cxx +--- a/src/Indicator.cxx Fri Apr 07 19:44:24 2017 +1000 ++++ b/src/Indicator.cxx Fri Apr 07 19:44:59 2017 +1000 +@@ -21,7 +21,8 @@ + + static PRectangle PixelGridAlign(const PRectangle &rc) { + // Move left and right side to nearest pixel to avoid blurry visuals +- return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom)); ++ return PRectangle::FromInts(static_cast<int>(rc.left + 0.5), static_cast<int>(rc.top), ++ static_cast<int>(rc.right + 0.5), static_cast<int>(rc.bottom)); + } + + void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const { +@@ -35,8 +36,8 @@ + surface->PenColour(sacDraw.fore); + int ymid = static_cast<int>(rc.bottom + rc.top) / 2; + if (sacDraw.style == INDIC_SQUIGGLE) { +- int x = int(rc.left+0.5); +- const int xLast = int(rc.right+0.5); ++ int x = static_cast<int>(rc.left+0.5); ++ const int xLast = static_cast<int>(rc.right+0.5); + int y = 0; + surface->MoveTo(x, static_cast<int>(rc.top) + y); + while (x < xLast) { +diff -r 150bdfbe2b5a -r d742ec177a7e win32/PlatWin.cxx +--- a/win32/PlatWin.cxx Fri Apr 07 19:44:24 2017 +1000 ++++ b/win32/PlatWin.cxx Fri Apr 07 19:44:59 2017 +1000 +@@ -1292,7 +1292,7 @@ + } + + static float RoundFloat(float f) { +- return float(int(f+0.5f)); ++ return static_cast<float>(static_cast<int>(f+0.5f)); + } + + void SurfaceD2D::LineTo(int x_, int y_) { +@@ -1899,7 +1899,7 @@ + FlipBitmap(info.hbmMask, bmp.bmWidth, bmp.bmHeight); + if (info.hbmColor != NULL) + FlipBitmap(info.hbmColor, bmp.bmWidth, bmp.bmHeight); +- info.xHotspot = (DWORD)bmp.bmWidth - 1 - info.xHotspot; ++ info.xHotspot = static_cast<DWORD>(bmp.bmWidth) - 1 - info.xHotspot; + + reverseArrowCursor = ::CreateIconIndirect(&info); + if (reverseArrowCursor != NULL) +diff -r 150bdfbe2b5a -r d742ec177a7e win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Fri Apr 07 19:44:24 2017 +1000 ++++ b/win32/ScintillaWin.cxx Fri Apr 07 19:44:59 2017 +1000 +@@ -2689,11 +2689,11 @@ + const int rcFeedLen = static_cast<int>(rcFeed.length()) * sizeof(wchar_t); + const int rcSize = sizeof(RECONVERTSTRING) + rcFeedLen + sizeof(wchar_t); + +- RECONVERTSTRING *rc = (RECONVERTSTRING *)lParam; ++ RECONVERTSTRING *rc = reinterpret_cast<RECONVERTSTRING *>(lParam); + if (!rc) + return rcSize; // Immediately be back with rcSize of memory block. + +- wchar_t *rcFeedStart = (wchar_t*)(rc + 1); ++ wchar_t *rcFeedStart = reinterpret_cast<wchar_t*>(rc + 1); + memcpy(rcFeedStart, &rcFeed[0], rcFeedLen); + + std::string rcCompString = RangeText(mainStart, mainEnd); +@@ -2704,10 +2704,10 @@ + // Map selection to dwCompStr. + // No selection assumes current caret as rcCompString without length. + rc->dwVersion = 0; // It should be absolutely 0. +- rc->dwStrLen = (DWORD)static_cast<int>(rcFeed.length()); ++ rc->dwStrLen = static_cast<DWORD>(rcFeed.length()); + rc->dwStrOffset = sizeof(RECONVERTSTRING); +- rc->dwCompStrLen = (DWORD)static_cast<int>(rcCompWstring.length()); +- rc->dwCompStrOffset = (DWORD)static_cast<int>(rcCompWstart.length()) * sizeof(wchar_t); ++ rc->dwCompStrLen = static_cast<DWORD>(rcCompWstring.length()); ++ rc->dwCompStrOffset = static_cast<DWORD>(rcCompWstart.length()) * sizeof(wchar_t); + rc->dwTargetStrLen = rc->dwCompStrLen; + rc->dwTargetStrOffset =rc->dwCompStrOffset; + diff --git a/src/scintilla_backports/6176_20120f9d1698.patch b/src/scintilla_backports/6176_20120f9d1698.patch new file mode 100644 index 00000000..2622c3a0 --- /dev/null +++ b/src/scintilla_backports/6176_20120f9d1698.patch @@ -0,0 +1,19 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491606364 -36000 +# Node ID 20120f9d1698f2a5b36ca9fa2e01ed08fa9776fd +# Parent d742ec177a7eab50fa56cf453d32ed211f767365 +Use reference for efficiency. + +diff -r d742ec177a7e -r 20120f9d1698 src/Editor.cxx +--- a/src/Editor.cxx Fri Apr 07 19:44:59 2017 +1000 ++++ b/src/Editor.cxx Sat Apr 08 09:06:04 2017 +1000 +@@ -4301,7 +4301,7 @@ + const SelectionPosition pos = SPositionFromLocation(pt, false, true); + const Point ptPos = LocationFromPosition(pos); + for (size_t r=0; r<sel.Count(); r++) { +- const SelectionRange range = sel.Range(r); ++ const SelectionRange &range = sel.Range(r); + if (range.Contains(pos)) { + bool hit = true; + if (pos == range.Start()) { diff --git a/src/scintilla_backports/6182_7c132e9340ce.patch b/src/scintilla_backports/6182_7c132e9340ce.patch new file mode 100644 index 00000000..4eaca03a --- /dev/null +++ b/src/scintilla_backports/6182_7c132e9340ce.patch @@ -0,0 +1,43 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1491982645 -36000 +# Node ID 7c132e9340ce3425120c0c84820461d238f0560a +# Parent 75b60222c770944068ee3492a39e82a29c775da6 +For speed, store height of capital letters in FontMeasurements so not +recalculated for every character blob. + +diff -r 75b60222c770 -r 7c132e9340ce src/EditView.cxx +--- a/src/EditView.cxx Tue Apr 11 18:11:18 2017 +1000 ++++ b/src/EditView.cxx Wed Apr 12 17:37:25 2017 +1000 +@@ -818,8 +818,7 @@ + surface->FillRectangle(rcSegment, textBack); + } + FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; +- int normalCharHeight = static_cast<int>(surface->Ascent(ctrlCharsFont) - +- surface->InternalLeading(ctrlCharsFont)); ++ const int normalCharHeight = static_cast<int>(ceil(vsDraw.styles[STYLE_CONTROLCHAR].capitalHeight)); + PRectangle rcCChar = rcSegment; + rcCChar.left = rcCChar.left + 1; + rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; +diff -r 75b60222c770 -r 7c132e9340ce src/Style.h +--- a/src/Style.h Tue Apr 11 18:11:18 2017 +1000 ++++ b/src/Style.h Wed Apr 12 17:37:25 2017 +1000 +@@ -46,6 +46,7 @@ + struct FontMeasurements { + unsigned int ascent; + unsigned int descent; ++ XYPOSITION capitalHeight; // Top of capital letter to baseline: ascent - internal leading + XYPOSITION aveCharWidth; + XYPOSITION spaceWidth; + int sizeZoomed; +diff -r 75b60222c770 -r 7c132e9340ce src/ViewStyle.cxx +--- a/src/ViewStyle.cxx Tue Apr 11 18:11:18 2017 +1000 ++++ b/src/ViewStyle.cxx Wed Apr 12 17:37:25 2017 +1000 +@@ -86,6 +86,7 @@ + + ascent = static_cast<unsigned int>(surface.Ascent(font)); + descent = static_cast<unsigned int>(surface.Descent(font)); ++ capitalHeight = surface.Ascent(font) - surface.InternalLeading(font); + aveCharWidth = surface.AverageCharWidth(font); + spaceWidth = surface.WidthChar(font, ' '); + } diff --git a/src/scintilla_backports/6183_3e2dd5970075.patch b/src/scintilla_backports/6183_3e2dd5970075.patch new file mode 100644 index 00000000..e8da9fe3 --- /dev/null +++ b/src/scintilla_backports/6183_3e2dd5970075.patch @@ -0,0 +1,18 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1492139205 -36000 +# Node ID 3e2dd597007504f8745a3fed53ccba9bbe611265 +# Parent 7c132e9340ce3425120c0c84820461d238f0560a +Ensure capitalHeight initialised. + +diff -r 7c132e9340ce -r 3e2dd5970075 src/Style.cxx +--- a/src/Style.cxx Wed Apr 12 17:37:25 2017 +1000 ++++ b/src/Style.cxx Fri Apr 14 13:06:45 2017 +1000 +@@ -68,6 +68,7 @@ + void FontMeasurements::Clear() { + ascent = 1; + descent = 1; ++ capitalHeight = 1; + aveCharWidth = 1; + spaceWidth = 1; + sizeZoomed = 2; diff --git a/src/scintilla_backports/6184_692a54eaa604.patch b/src/scintilla_backports/6184_692a54eaa604.patch new file mode 100644 index 00000000..de8c79b8 --- /dev/null +++ b/src/scintilla_backports/6184_692a54eaa604.patch @@ -0,0 +1,92 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1492230489 -36000 +# Node ID 692a54eaa6049d6ea3459f66c001ef0c8ea7668f +# Parent 3e2dd597007504f8745a3fed53ccba9bbe611265 +Use bool literals true and false instead of 1 and 0. + +diff -r 3e2dd5970075 -r 692a54eaa604 lexers/LexHTML.cxx +--- a/lexers/LexHTML.cxx Fri Apr 14 13:06:45 2017 +1000 ++++ b/lexers/LexHTML.cxx Sat Apr 15 14:28:09 2017 +1000 +@@ -490,9 +490,9 @@ + return ((ch == '/') && (chNext == '>')); + } else if (0 == strcmp(blockType, "%")) { + if (ch == '/' && isLineEnd(chNext)) +- return 1; ++ return true; + else +- return isLineEnd(ch); ++ return isLineEnd(ch); + } else if (0 == strcmp(blockType, "{")) { + return ch == '}'; + } else { +@@ -502,13 +502,13 @@ + + static bool isDjangoBlockEnd(const int ch, const int chNext, const char *blockType) { + if (strlen(blockType) == 0) { +- return 0; ++ return false; + } else if (0 == strcmp(blockType, "%")) { + return ((ch == '%') && (chNext == '}')); + } else if (0 == strcmp(blockType, "{")) { + return ((ch == '}') && (chNext == '}')); + } else { +- return 0; ++ return false; + } + } + +diff -r 3e2dd5970075 -r 692a54eaa604 src/Editor.cxx +--- a/src/Editor.cxx Fri Apr 14 13:06:45 2017 +1000 ++++ b/src/Editor.cxx Sat Apr 15 14:28:09 2017 +1000 +@@ -5331,7 +5331,7 @@ + if (action == SC_FOLDACTION_CONTRACT) { + const Sci::Line lineMaxSubord = pdoc->GetLastChild(line); + if (lineMaxSubord > line) { +- cs.SetExpanded(line, 0); ++ cs.SetExpanded(line, false); + cs.SetVisible(line + 1, lineMaxSubord, false); + + const Sci::Line lineCurrent = pdoc->LineFromPosition(sel.MainCaret()); +@@ -5346,7 +5346,7 @@ + EnsureLineVisible(line, false); + GoToLine(line); + } +- cs.SetExpanded(line, 1); ++ cs.SetExpanded(line, true); + ExpandLine(line); + } + +@@ -5419,7 +5419,7 @@ + if (lineDoc != lineParent) + EnsureLineVisible(lineParent, enforcePolicy); + if (!cs.GetExpanded(lineParent)) { +- cs.SetExpanded(lineParent, 1); ++ cs.SetExpanded(lineParent, true); + ExpandLine(lineParent); + } + } +diff -r 3e2dd5970075 -r 692a54eaa604 src/PerLine.cxx +--- a/src/PerLine.cxx Fri Apr 14 13:06:45 2017 +1000 ++++ b/src/PerLine.cxx Sat Apr 15 14:28:09 2017 +1000 +@@ -385,7 +385,7 @@ + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return reinterpret_cast<AnnotationHeader *>(annotations[line])->style == IndividualStyles; + else +- return 0; ++ return false; + } + + int LineAnnotation::Style(Sci::Line line) const { +diff -r 3e2dd5970075 -r 692a54eaa604 src/PositionCache.cxx +--- a/src/PositionCache.cxx Fri Apr 14 13:06:45 2017 +1000 ++++ b/src/PositionCache.cxx Sat Apr 15 14:28:09 2017 +1000 +@@ -55,7 +55,7 @@ + numCharsBeforeEOL(0), + validity(llInvalid), + xHighlightGuide(0), +- highlightColumn(0), ++ highlightColumn(false), + containsCaret(false), + edgeColumn(0), + chars(0), diff --git a/src/scintilla_backports/6185_b8379bec8e70.patch b/src/scintilla_backports/6185_b8379bec8e70.patch new file mode 100644 index 00000000..7d946ead --- /dev/null +++ b/src/scintilla_backports/6185_b8379bec8e70.patch @@ -0,0 +1,35 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1492232428 -36000 +# Node ID b8379bec8e70bf09df25f01d0a78a53cf61b1827 +# Parent 692a54eaa6049d6ea3459f66c001ef0c8ea7668f +Fix deprecation of gdk_window_process_updates in GTK+ 3.22 by redrawing instead +of scrolling. + +diff -r 692a54eaa604 -r b8379bec8e70 gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Sat Apr 15 14:28:09 2017 +1000 ++++ b/gtk/ScintillaGTK.cxx Sat Apr 15 15:00:28 2017 +1000 +@@ -1031,16 +1031,18 @@ + } + + void ScintillaGTK::ScrollText(Sci::Line linesToMove) { +- int diff = vs.lineHeight * -linesToMove; +- //Platform::DebugPrintf("ScintillaGTK::ScrollText %d %d %0d,%0d %0d,%0d\n", linesToMove, diff, +- // rc.left, rc.top, rc.right, rc.bottom); ++ NotifyUpdateUI(); ++ ++#if GTK_CHECK_VERSION(3,22,0) ++ Redraw(); ++#else + GtkWidget *wi = PWidget(wText); +- NotifyUpdateUI(); +- + if (IS_WIDGET_REALIZED(wi)) { ++ const int diff = vs.lineHeight * -linesToMove; + gdk_window_scroll(WindowFromWidget(wi), 0, -diff); + gdk_window_process_updates(WindowFromWidget(wi), FALSE); + } ++#endif + } + + void ScintillaGTK::SetVerticalScrollPos() { diff --git a/src/scintilla_backports/6186_044d2d030263.patch b/src/scintilla_backports/6186_044d2d030263.patch new file mode 100644 index 00000000..d0f88231 --- /dev/null +++ b/src/scintilla_backports/6186_044d2d030263.patch @@ -0,0 +1,218 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1492238872 -36000 +# Node ID 044d2d0302639d08d3e0aa72886afcbd47fa39f8 +# Parent b8379bec8e70bf09df25f01d0a78a53cf61b1827 +Avoid calling virtual functions in constructors and destructors. + +diff -r b8379bec8e70 -r 044d2d030263 cocoa/ScintillaCocoa.h +--- a/cocoa/ScintillaCocoa.h Sat Apr 15 15:00:28 2017 +1000 ++++ b/cocoa/ScintillaCocoa.h Sat Apr 15 16:47:52 2017 +1000 +@@ -128,7 +128,7 @@ + void DiscardOverdraw() override; + void Redraw() override; + +- void Initialise() override; ++ void Init(); + void Finalise() override; + CaseFolder *CaseFolderForEncoding() override; + std::string CaseMapString(const std::string &s, int caseMapping) override; +diff -r b8379bec8e70 -r 044d2d030263 cocoa/ScintillaCocoa.mm +--- a/cocoa/ScintillaCocoa.mm Sat Apr 15 15:00:28 2017 +1000 ++++ b/cocoa/ScintillaCocoa.mm Sat Apr 15 16:47:52 2017 +1000 +@@ -422,7 +422,7 @@ + { + timers[tr] = nil; + } +- Initialise(); ++ Init(); + } + + //-------------------------------------------------------------------------------------------------- +@@ -439,7 +439,7 @@ + /** + * Core initialization of the control. Everything that needs to be set up happens here. + */ +-void ScintillaCocoa::Initialise() ++void ScintillaCocoa::Init() + { + Scintilla_LinkLexers(); + +diff -r b8379bec8e70 -r 044d2d030263 gtk/PlatGTK.cxx +--- a/gtk/PlatGTK.cxx Sat Apr 15 15:00:28 2017 +1000 ++++ b/gtk/PlatGTK.cxx Sat Apr 15 16:47:52 2017 +1000 +@@ -168,6 +168,7 @@ + void Init(SurfaceID sid, WindowID wid) override; + void InitPixMap(int width, int height, Surface *surface_, WindowID wid) override; + ++ void Clear(); + void Release(); + bool Initialised(); + void PenColour(ColourDesired fore); +@@ -276,10 +277,10 @@ + } + + SurfaceImpl::~SurfaceImpl() { +- Release(); ++ Clear(); + } + +-void SurfaceImpl::Release() { ++void SurfaceImpl::Clear() { + et = singleByte; + if (createdGC) { + createdGC = false; +@@ -303,6 +304,10 @@ + createdGC = false; + } + ++void SurfaceImpl::Release() { ++ Clear(); ++} ++ + bool SurfaceImpl::Initialised() { + #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0) + if (inited && context) { +diff -r b8379bec8e70 -r 044d2d030263 gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Sat Apr 15 15:00:28 2017 +1000 ++++ b/gtk/ScintillaGTK.cxx Sat Apr 15 16:47:52 2017 +1000 +@@ -205,7 +205,7 @@ + lastWheelMouseTime.tv_sec = 0; + lastWheelMouseTime.tv_usec = 0; + +- Initialise(); ++ Init(); + } + + ScintillaGTK::~ScintillaGTK() { +@@ -549,8 +549,7 @@ + } + } + +-void ScintillaGTK::Initialise() { +- //Platform::DebugPrintf("ScintillaGTK::Initialise\n"); ++void ScintillaGTK::Init() { + parentClass = reinterpret_cast<GtkWidgetClass *>( + g_type_class_ref(gtk_container_get_type())); + +@@ -3044,7 +3043,7 @@ + + // Define default signal handlers for the class: Could move more + // of the signal handlers here (those that currently attached to wDraw +- // in Initialise() may require coordinate translation?) ++ // in Init() may require coordinate translation?) + + object_class->dispose = Dispose; + object_class->finalize = Destroy; +diff -r b8379bec8e70 -r 044d2d030263 gtk/ScintillaGTK.h +--- a/gtk/ScintillaGTK.h Sat Apr 15 15:00:28 2017 +1000 ++++ b/gtk/ScintillaGTK.h Sat Apr 15 16:47:52 2017 +1000 +@@ -81,7 +81,7 @@ + static ScintillaGTK *FromWidget(GtkWidget *widget); + static void ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class); + private: +- virtual void Initialise(); ++ void Init(); + virtual void Finalise(); + virtual bool AbandonPaint(); + virtual void DisplayCursor(Window::Cursor c); +diff -r b8379bec8e70 -r 044d2d030263 qt/ScintillaEditBase/ScintillaQt.cpp +--- a/qt/ScintillaEditBase/ScintillaQt.cpp Sat Apr 15 15:00:28 2017 +1000 ++++ b/qt/ScintillaEditBase/ScintillaQt.cpp Sat Apr 15 16:47:52 2017 +1000 +@@ -45,7 +45,7 @@ + // Buffered drawing turned off by default to avoid this. + WndProc(SCI_SETBUFFEREDDRAW, false, 0); + +- Initialise(); ++ Init(); + + for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast<TickReason>(tr + 1)) { + timers[tr] = 0; +@@ -128,7 +128,7 @@ + + #endif + +-void ScintillaQt::Initialise() ++void ScintillaQt::Init() + { + #if defined(Q_OS_WIN) || defined(Q_OS_MAC) + rectangularSelectionModifier = SCMOD_ALT; +diff -r b8379bec8e70 -r 044d2d030263 qt/ScintillaEditBase/ScintillaQt.h +--- a/qt/ScintillaEditBase/ScintillaQt.h Sat Apr 15 15:00:28 2017 +1000 ++++ b/qt/ScintillaEditBase/ScintillaQt.h Sat Apr 15 16:47:52 2017 +1000 +@@ -99,7 +99,7 @@ + void SelectionChanged(); + + private: +- virtual void Initialise(); ++ void Init(); + virtual void Finalise(); + virtual bool DragThreshold(Point ptStart, Point ptNow); + virtual bool ValidCodePage(int codePage) const; +diff -r b8379bec8e70 -r 044d2d030263 src/PerLine.cxx +--- a/src/PerLine.cxx Sat Apr 15 15:00:28 2017 +1000 ++++ b/src/PerLine.cxx Sat Apr 15 16:47:52 2017 +1000 +@@ -121,7 +121,11 @@ + } + + LineMarkers::~LineMarkers() { +- Init(); ++ for (int line = 0; line < markers.Length(); line++) { ++ delete markers[line]; ++ markers[line] = 0; ++ } ++ markers.DeleteAll(); + } + + void LineMarkers::Init() { +@@ -490,7 +494,10 @@ + } + + LineTabstops::~LineTabstops() { +- Init(); ++ for (int line = 0; line < tabstops.Length(); line++) { ++ delete tabstops[line]; ++ } ++ tabstops.DeleteAll(); + } + + void LineTabstops::Init() { +diff -r b8379bec8e70 -r 044d2d030263 src/ScintillaBase.h +--- a/src/ScintillaBase.h Sat Apr 15 15:00:28 2017 +1000 ++++ b/src/ScintillaBase.h Sat Apr 15 16:47:52 2017 +1000 +@@ -59,7 +59,7 @@ + + ScintillaBase(); + virtual ~ScintillaBase(); +- virtual void Initialise() = 0; ++ void Initialise() {} + virtual void Finalise(); + + virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); +diff -r b8379bec8e70 -r 044d2d030263 win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Sat Apr 15 15:00:28 2017 +1000 ++++ b/win32/ScintillaWin.cxx Sat Apr 15 16:47:52 2017 +1000 +@@ -276,7 +276,7 @@ + ~ScintillaWin() override; + ScintillaWin &operator=(const ScintillaWin &); + +- void Initialise() override; ++ void Init(); + void Finalise() override; + #if defined(USE_D2D) + void EnsureRenderTarget(HDC hdc); +@@ -459,12 +459,12 @@ + if (caret.period < 0) + caret.period = 0; + +- Initialise(); ++ Init(); + } + + ScintillaWin::~ScintillaWin() {} + +-void ScintillaWin::Initialise() { ++void ScintillaWin::Init() { + // Initialize COM. If the app has already done this it will have + // no effect. If the app hasn't, we really shouldn't ask them to call + // it just so this internal feature works. diff --git a/src/scintilla_backports/6187_a80a6876c301.patch b/src/scintilla_backports/6187_a80a6876c301.patch new file mode 100644 index 00000000..9c6a92af --- /dev/null +++ b/src/scintilla_backports/6187_a80a6876c301.patch @@ -0,0 +1,91 @@ +# HG changeset patch +# User Neil Hodgson <nyamatongwe@gmail.com> +# Date 1492240107 -36000 +# Node ID a80a6876c301ec0caf29ef20eb2161f6af9a8552 +# Parent 044d2d0302639d08d3e0aa72886afcbd47fa39f8 +Avoid calling virtual functions in destructor. Mark overridden methods. + +diff -r 044d2d030263 -r a80a6876c301 cocoa/ScintillaCocoa.h +--- a/cocoa/ScintillaCocoa.h Sat Apr 15 16:47:52 2017 +1000 ++++ b/cocoa/ScintillaCocoa.h Sat Apr 15 17:08:27 2017 +1000 +@@ -129,7 +129,6 @@ + void Redraw() override; + + void Init(); +- void Finalise() override; + CaseFolder *CaseFolderForEncoding() override; + std::string CaseMapString(const std::string &s, int caseMapping) override; + void CancelModes() override; +@@ -137,6 +136,7 @@ + public: + ScintillaCocoa(ScintillaView* sciView_, SCIContentView* viewContent, SCIMarginView* viewMargin); + ~ScintillaCocoa() override; ++ void Finalise() override; + + void SetDelegate(id<ScintillaNotificationProtocol> delegate_); + void RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback); +diff -r 044d2d030263 -r a80a6876c301 cocoa/ScintillaCocoa.mm +--- a/cocoa/ScintillaCocoa.mm Sat Apr 15 16:47:52 2017 +1000 ++++ b/cocoa/ScintillaCocoa.mm Sat Apr 15 17:08:27 2017 +1000 +@@ -429,7 +429,6 @@ + + ScintillaCocoa::~ScintillaCocoa() + { +- Finalise(); + [timerTarget ownerDestroyed]; + [timerTarget release]; + } +diff -r 044d2d030263 -r a80a6876c301 cocoa/ScintillaView.mm +--- a/cocoa/ScintillaView.mm Sat Apr 15 16:47:52 2017 +1000 ++++ b/cocoa/ScintillaView.mm Sat Apr 15 17:08:27 2017 +1000 +@@ -1559,6 +1559,7 @@ + - (void) dealloc + { + [[NSNotificationCenter defaultCenter] removeObserver:self]; ++ mBackend->Finalise(); + delete mBackend; + mBackend = NULL; + mContent.owner = nil; +diff -r 044d2d030263 -r a80a6876c301 src/ScintillaBase.h +--- a/src/ScintillaBase.h Sat Apr 15 16:47:52 2017 +1000 ++++ b/src/ScintillaBase.h Sat Apr 15 17:08:27 2017 +1000 +@@ -60,12 +60,12 @@ + ScintillaBase(); + virtual ~ScintillaBase(); + void Initialise() {} +- virtual void Finalise(); ++ void Finalise(); + +- virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); ++ void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); + void Command(int cmdId); +- virtual void CancelModes(); +- virtual int KeyCommand(unsigned int iMessage); ++ void CancelModes(); ++ int KeyCommand(unsigned int iMessage); + + void AutoCompleteInsert(Sci::Position startPos, int removeLen, const char *text, int textLen); + void AutoCompleteStart(int lenEntered, const char *list); +@@ -87,16 +87,16 @@ + bool ShouldDisplayPopup(Point ptInWindowCoordinates) const; + void ContextMenu(Point pt); + +- virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); +- virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); +- virtual void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); ++ void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); ++ void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); ++ void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); + +- void NotifyStyleToNeeded(Sci::Position endStyleNeeded); +- void NotifyLexerChanged(Document *doc, void *userData); ++ void NotifyStyleToNeeded(Sci::Position endStyleNeeded); ++ void NotifyLexerChanged(Document *doc, void *userData); + + public: + // Public so scintilla_send_message can use it +- virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); ++ sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + }; + + #ifdef SCI_NAMESPACE diff --git a/src/scintilla_backports/6196_e4f249dbdc30.patch b/src/scintilla_backports/6196_e4f249dbdc30.patch new file mode 100644 index 00000000..3ca9040b --- /dev/null +++ b/src/scintilla_backports/6196_e4f249dbdc30.patch @@ -0,0 +1,28 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1492586191 -36000 +# Node ID e4f249dbdc30e33291297c312042b760f825f4c0 +# Parent ba90de635fc390837399a66841392d1e87c829d5 +Drop reinterpret_cast when can implicit cast to void* or const void*. + +diff -r ba90de635fc3 -r e4f249dbdc30 src/PositionCache.cxx +--- a/src/PositionCache.cxx Wed Apr 19 15:30:08 2017 +1000 ++++ b/src/PositionCache.cxx Wed Apr 19 17:16:31 2017 +1000 +@@ -575,7 +575,7 @@ + for (unsigned int i=0; i<len; i++) { + positions[i] = positions_[i]; + } +- memcpy(reinterpret_cast<void *>(positions + len), s_, len); ++ memcpy(positions + len, s_, len); + } + } + +@@ -594,7 +594,7 @@ + bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, + unsigned int len_, XYPOSITION *positions_) const { + if ((styleNumber == styleNumber_) && (len == len_) && +- (memcmp(reinterpret_cast<void *>(positions + len), s_, len)== 0)) { ++ (memcmp(positions + len, s_, len)== 0)) { + for (unsigned int i=0; i<len; i++) { + positions_[i] = positions[i]; + } diff --git a/src/scintilla_backports/6215_1f02cb4a5b26.patch b/src/scintilla_backports/6215_1f02cb4a5b26.patch new file mode 100644 index 00000000..093df2cb --- /dev/null +++ b/src/scintilla_backports/6215_1f02cb4a5b26.patch @@ -0,0 +1,33 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1493072833 -36000 +# Node ID 1f02cb4a5b26d6774b09fc59f8fb4fbd1098c5ef +# Parent 23af3d7bb75a20bd0e3c0ccf3f341b9defa070e5 +Bug [#1940]. Canceling modes with the Esc key preserves a rectangular selection. + +diff -r 23af3d7bb75a -r 1f02cb4a5b26 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Mon Apr 24 08:36:05 2017 +1000 ++++ b/doc/ScintillaHistory.html Tue Apr 25 08:27:13 2017 +1000 +@@ -560,6 +560,10 @@ + <a href="http://sourceforge.net/p/scintilla/bugs/1931/">Bug #1931</a>. + </li> + <li> ++ Canceling modes with the Esc key preserves a rectangular selection. ++ <a href="http://sourceforge.net/p/scintilla/bugs/1940/">Bug #1940</a>. ++ </li> ++ <li> + On Cocoa, a leak of mouse tracking areas was fixed. + </li> + <li> +diff -r 23af3d7bb75a -r 1f02cb4a5b26 src/Editor.cxx +--- a/src/Editor.cxx Mon Apr 24 08:36:05 2017 +1000 ++++ b/src/Editor.cxx Tue Apr 25 08:27:13 2017 +1000 +@@ -3745,7 +3745,7 @@ + case SCI_CANCEL: // Cancel any modes - handled in subclass + // Also unselect text + CancelModes(); +- if (sel.Count() > 1) { ++ if ((sel.Count() > 1) && !sel.IsRectangular()) { + // Drop additional selections + InvalidateWholeSelection(); + sel.DropAdditionalRanges(); diff --git a/src/scintilla_backports/6222_45f968a6735a.patch b/src/scintilla_backports/6222_45f968a6735a.patch new file mode 100644 index 00000000..918b9579 --- /dev/null +++ b/src/scintilla_backports/6222_45f968a6735a.patch @@ -0,0 +1,222 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1493717258 -36000 +# Node ID 45f968a6735a89a219c8461ea3312655cc15da83 +# Parent da6b7ddd88fe823d0e4b985ace8903ccf304d573 +More consistent use of size_t when converting Unicode formats. + +diff -r da6b7ddd88fe -r 45f968a6735a src/Document.cxx +--- a/src/Document.cxx Tue May 02 11:16:00 2017 +1000 ++++ b/src/Document.cxx Tue May 02 19:27:38 2017 +1000 +@@ -2883,7 +2883,7 @@ + + bool matched = false; + if (SC_CP_UTF8 == doc->dbcsCodePage) { +- unsigned int lenS = static_cast<unsigned int>(strlen(s)); ++ size_t lenS = strlen(s); + std::vector<wchar_t> ws(lenS + 1); + #if WCHAR_T_IS_16 + size_t outLen = UTF16FromUTF8(s, lenS, &ws[0], lenS); +diff -r da6b7ddd88fe -r 45f968a6735a src/UniConversion.cxx +--- a/src/UniConversion.cxx Tue May 02 11:16:00 2017 +1000 ++++ b/src/UniConversion.cxx Tue May 02 19:27:38 2017 +1000 +@@ -20,9 +20,9 @@ + namespace Scintilla { + #endif + +-unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { +- unsigned int len = 0; +- for (unsigned int i = 0; i < tlen && uptr[i];) { ++size_t UTF8Length(const wchar_t *uptr, size_t tlen) { ++ size_t len = 0; ++ for (size_t i = 0; i < tlen && uptr[i];) { + const unsigned int uch = uptr[i]; + if (uch < 0x80) { + len++; +@@ -40,9 +40,9 @@ + return len; + } + +-void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) { +- unsigned int k = 0; +- for (unsigned int i = 0; i < tlen && uptr[i];) { ++void UTF8FromUTF16(const wchar_t *uptr, size_t tlen, char *putf, size_t len) { ++ size_t k = 0; ++ for (size_t i = 0; i < tlen && uptr[i];) { + const unsigned int uch = uptr[i]; + if (uch < 0x80) { + putf[k++] = static_cast<char>(uch); +@@ -138,10 +138,10 @@ + return ui; + } + +-unsigned int UTF32FromUTF8(const char *s, unsigned int len, unsigned int *tbuf, unsigned int tlen) { +- unsigned int ui=0; ++size_t UTF32FromUTF8(const char *s, size_t len, unsigned int *tbuf, size_t tlen) { ++ size_t ui=0; + const unsigned char *us = reinterpret_cast<const unsigned char *>(s); +- unsigned int i=0; ++ size_t i=0; + while ((i<len) && (ui<tlen)) { + unsigned char ch = us[i++]; + unsigned int value = 0; +diff -r da6b7ddd88fe -r 45f968a6735a src/UniConversion.h +--- a/src/UniConversion.h Tue May 02 11:16:00 2017 +1000 ++++ b/src/UniConversion.h Tue May 02 19:27:38 2017 +1000 +@@ -16,12 +16,12 @@ + + const int unicodeReplacementChar = 0xFFFD; + +-unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); +-void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len); ++size_t UTF8Length(const wchar_t *uptr, size_t tlen); ++void UTF8FromUTF16(const wchar_t *uptr, size_t tlen, char *putf, size_t len); + unsigned int UTF8CharLength(unsigned char ch); + size_t UTF16Length(const char *s, size_t len); + size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen); +-unsigned int UTF32FromUTF8(const char *s, unsigned int len, unsigned int *tbuf, unsigned int tlen); ++size_t UTF32FromUTF8(const char *s, size_t len, unsigned int *tbuf, size_t tlen); + unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf); + std::string FixInvalidUTF8(const std::string &text); + +diff -r da6b7ddd88fe -r 45f968a6735a win32/PlatWin.cxx +--- a/win32/PlatWin.cxx Tue May 02 11:16:00 2017 +1000 ++++ b/win32/PlatWin.cxx Tue May 02 19:27:38 2017 +1000 +@@ -481,7 +481,7 @@ + const int stackBufferLength = 1000; + class TextWide : public VarBuffer<wchar_t, stackBufferLength> { + public: +- int tlen; ++ int tlen; // Using int instead of size_t as most Win32 APIs take int. + TextWide(const char *s, int len, bool unicodeMode, int codePage=0) : + VarBuffer<wchar_t, stackBufferLength>(len) { + if (unicodeMode) { +diff -r da6b7ddd88fe -r 45f968a6735a win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Tue May 02 11:16:00 2017 +1000 ++++ b/win32/ScintillaWin.cxx Tue May 02 19:27:38 2017 +1000 +@@ -782,10 +782,10 @@ + void ScintillaWin::AddCharUTF16(wchar_t const *wcs, unsigned int wclen) { + if (IsUnicodeMode()) { + char utfval[maxLenInputIME * 3]; +- unsigned int len = UTF8Length(wcs, wclen); ++ size_t len = UTF8Length(wcs, wclen); + UTF8FromUTF16(wcs, wclen, utfval, len); + utfval[len] = '\0'; +- AddCharUTF(utfval, len); ++ AddCharUTF(utfval, static_cast<unsigned int>(len)); + } else { + UINT cpDest = CodePageOfDocument(); + char inBufferCP[maxLenInputIME * 2]; +@@ -1178,7 +1178,7 @@ + std::vector<char> docBytes(pdoc->Length(), '\0'); + pdoc->GetCharRange(&docBytes[0], 0, pdoc->Length()); + if (IsUnicodeMode()) { +- return UTF16Length(&docBytes[0], static_cast<unsigned int>(docBytes.size())); ++ return UTF16Length(&docBytes[0], docBytes.size()); + } else { + return ::MultiByteToWideChar(CodePageOfDocument(), 0, &docBytes[0], + static_cast<int>(docBytes.size()), NULL, 0); +@@ -1200,7 +1200,7 @@ + if (wParam == 0) + return 0; + size_t uLen = UTF16FromUTF8(&docBytes[0], docBytes.size(), +- ptr, static_cast<int>(wParam) - 1); ++ ptr, wParam - 1); + ptr[uLen] = L'\0'; + return uLen; + } else { +@@ -2231,11 +2231,11 @@ + if (memUSelection) { + wchar_t *uptr = static_cast<wchar_t *>(memUSelection.ptr); + if (uptr) { +- unsigned int len; ++ size_t len; + std::vector<char> putf; + // Default Scintilla behaviour in Unicode mode + if (IsUnicodeMode()) { +- const unsigned int bytes = static_cast<unsigned int>(memUSelection.Size()); ++ const size_t bytes = memUSelection.Size(); + len = UTF8Length(uptr, bytes / 2); + putf.resize(len + 1); + UTF8FromUTF16(uptr, bytes / 2, &putf[0], len); +@@ -2247,10 +2247,10 @@ + NULL, 0, NULL, NULL) - 1; // subtract 0 terminator + putf.resize(len + 1); + ::WideCharToMultiByte(cpDest, 0, uptr, -1, +- &putf[0], len + 1, NULL, NULL); ++ &putf[0], static_cast<int>(len) + 1, NULL, NULL); + } + +- InsertPasteShape(&putf[0], len, pasteShape); ++ InsertPasteShape(&putf[0], static_cast<int>(len), pasteShape); + } + memUSelection.Unlock(); + } else { +@@ -2259,27 +2259,28 @@ + if (memSelection) { + char *ptr = static_cast<char *>(memSelection.ptr); + if (ptr) { +- const unsigned int bytes = static_cast<unsigned int>(memSelection.Size()); +- unsigned int len = bytes; +- for (unsigned int i = 0; i < bytes; i++) { ++ const size_t bytes = memSelection.Size(); ++ size_t len = bytes; ++ for (size_t i = 0; i < bytes; i++) { + if ((len == bytes) && (0 == ptr[i])) + len = i; + } ++ const int ilen = static_cast<int>(len); + + // In Unicode mode, convert clipboard text to UTF-8 + if (IsUnicodeMode()) { + std::vector<wchar_t> uptr(len+1); + +- const unsigned int ulen = ::MultiByteToWideChar(CP_ACP, 0, +- ptr, len, &uptr[0], len+1); +- +- unsigned int mlen = UTF8Length(&uptr[0], ulen); ++ const size_t ulen = ::MultiByteToWideChar(CP_ACP, 0, ++ ptr, ilen, &uptr[0], ilen +1); ++ ++ const size_t mlen = UTF8Length(&uptr[0], ulen); + std::vector<char> putf(mlen+1); + UTF8FromUTF16(&uptr[0], ulen, &putf[0], mlen); + +- InsertPasteShape(&putf[0], mlen, pasteShape); ++ InsertPasteShape(&putf[0], static_cast<int>(mlen), pasteShape); + } else { +- InsertPasteShape(ptr, len, pasteShape); ++ InsertPasteShape(ptr, ilen, pasteShape); + } + } + memSelection.Unlock(); +@@ -2770,7 +2771,7 @@ + // Default Scintilla behaviour in Unicode mode + if (IsUnicodeMode()) { + size_t uchars = UTF16Length(selectedText.Data(), +- static_cast<int>(selectedText.LengthWithTerminator())); ++ selectedText.LengthWithTerminator()); + uniText.Allocate(2 * uchars); + if (uniText) { + UTF16FromUTF8(selectedText.Data(), selectedText.LengthWithTerminator(), +@@ -3069,9 +3070,9 @@ + wchar_t *udata = static_cast<wchar_t *>(memUDrop.ptr); + if (udata) { + if (IsUnicodeMode()) { +- const int tlen = static_cast<int>(memUDrop.Size()); ++ const size_t tlen = memUDrop.Size(); + // Convert UTF-16 to UTF-8 +- int dataLen = UTF8Length(udata, tlen/2); ++ const size_t dataLen = UTF8Length(udata, tlen/2); + data.resize(dataLen+1); + UTF8FromUTF16(udata, tlen/2, &data[0], dataLen); + } else { +@@ -3146,7 +3147,7 @@ + + GlobalMemory text; + if (pFEIn->cfFormat == CF_UNICODETEXT) { +- size_t uchars = UTF16Length(drag.Data(), static_cast<int>(drag.LengthWithTerminator())); ++ size_t uchars = UTF16Length(drag.Data(), drag.LengthWithTerminator()); + text.Allocate(2 * uchars); + if (text) { + UTF16FromUTF8(drag.Data(), drag.LengthWithTerminator(), diff --git a/src/scintilla_backports/6231_61adfbe4fa64.patch b/src/scintilla_backports/6231_61adfbe4fa64.patch new file mode 100644 index 00000000..6945055a --- /dev/null +++ b/src/scintilla_backports/6231_61adfbe4fa64.patch @@ -0,0 +1,44 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1494389973 -36000 +# Node ID 61adfbe4fa64ed5ad99e36dc7220cd3c6f9b7659 +# Parent 6c164ebad8b9b40d9e757d49f37a4354f3c7fc03 +Feature [feature-requests:#1187]. Update scroll bar when annotations added, +removed, or visibility changed. + +diff -r 6c164ebad8b9 -r 61adfbe4fa64 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Wed May 10 14:15:16 2017 +1000 ++++ b/doc/ScintillaHistory.html Wed May 10 14:19:33 2017 +1000 +@@ -571,6 +571,10 @@ + <a href="http://sourceforge.net/p/scintilla/bugs/1931/">Bug #1931</a>. + </li> + <li> ++ Update scroll bar when annotations added, removed, or visibility changed. ++ <a href="http://sourceforge.net/p/scintilla/feature-requests/1187/">Feature #1187.</a> ++ </li> ++ <li> + Canceling modes with the Esc key preserves a rectangular selection. + <a href="http://sourceforge.net/p/scintilla/bugs/1940/">Bug #1940</a>. + </li> +diff -r 6c164ebad8b9 -r 61adfbe4fa64 src/Editor.cxx +--- a/src/Editor.cxx Wed May 10 14:15:16 2017 +1000 ++++ b/src/Editor.cxx Wed May 10 14:19:33 2017 +1000 +@@ -2629,7 +2629,9 @@ + if (mh.modificationType & SC_MOD_CHANGEANNOTATION) { + Sci::Line lineDoc = pdoc->LineFromPosition(mh.position); + if (vs.annotationVisible) { +- cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded); ++ if (cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded)) { ++ SetScrollBars(); ++ } + Redraw(); + } + } +@@ -5276,6 +5278,7 @@ + cs.SetHeight(line, cs.GetHeight(line) + annotationLines * dir); + } + } ++ SetScrollBars(); + } + Redraw(); + } |