Sublime Forum

Extreme values in sublime.Region() cause erratic behavior when added to view.sel()

#1

Problem description

It’s possible to create regions that start at a point < 0 or end at a point > view.size(). This seems to create erratic behavior if regions containing such points are added to the view.sel().

Examples:

  1. clear regions in non-empty view
  2. add Region(-1, 10)
  3. press left arrow or try to type

  1. clear regions in non-empty view
  2. add Region(10, 1000000)
  3. press right arrow or try to type

While this behavior exists, plugins have to take care to not exceed view boundaries when adding new regions.

Expected behavior

Perhaps values < 0 or > view.size() should be clipped to buffer boundaries.


Editor info (as provided by Sublime Text API)

General details about Sublime Text

Version and architecture

name: Sublime Text
version: 3121
architecture: x64
channel: dev
platform: windows

Package data

ommitted

View settings

syntax: Packages/Text/Plain text.tmLanguage
tab_size: 4
translate_tabs_to_spaces: False
encoding: Undefined
em width: 7.0
selection count: 1
has non empty selections: False

View state

is view dirty: True
is view readonly: False

Profiling data (as reported by Default/profile.py)
on_activated:
    Default.pane: 0.000s total, mean: 0.000s, max: 0.000s
    Vim.commands.event_sync_mode: 0.000s total, mean: 0.000s, max: 0.000s

on_deactivated:
    Default.history_list: 0.001s total, mean: 0.000s, max: 0.001s
    Vim.commands.event_sync_mode: 0.000s total, mean: 0.000s, max: 0.000s

on_modified:
    Default.settings: 0.002s total, mean: 0.000s, max: 0.001s

Platform info (as provided by wmic.exe)

Details about the current platform

OS information

OSArchitecture: 64-bit
Version: 10.0.14393
BuildNumber: 14393
BuildType: Multiprocessor Free
Caption: Microsoft Windows 10 Pro
FreePhysicalMemory: 11248868
FreeSpaceInPagingFiles: 2483488
FreeVirtualMemory: 12981408

Display information

PixelsPerXLogicalInch: 96
PixelsPerYLogicalInch: 96


This report was generated by the Troubleshooting package.

2 Likes

#2

Can confirm.

Could you please open an issue for this on https://github.com/SublimeTextIssues/Core/issues?

1 Like

#3
1 Like