ViewManager/ViewManager.py

changeset 4186
e2bf1c32272b
parent 4156
491fcdca9ff4
child 4298
4e7a0e2c20fc
equal deleted inserted replaced
4184:6dbd901a8b1a 4186:e2bf1c32272b
4409 selStart=0, selEnd=0, pos=0): 4409 selStart=0, selEnd=0, pos=0):
4410 """ 4410 """
4411 Public slot to display a file in an editor. 4411 Public slot to display a file in an editor.
4412 4412
4413 @param fn name of file to be opened (string) 4413 @param fn name of file to be opened (string)
4414 @param lineno line number to place the cursor at (integer) 4414 @param lineno line number to place the cursor at (integer) or
4415 list of line numbers (list of integers) (cursor will be
4416 placed at the next line greater than the current one)
4415 @param filetype type of the source file (string) 4417 @param filetype type of the source file (string)
4416 @param selStart start of an area to be selected (integer) 4418 @param selStart start of an area to be selected (integer)
4417 @param selEnd end of an area to be selected (integer) 4419 @param selEnd end of an area to be selected (integer)
4418 @param pos position within the line to place the cursor at (integer) 4420 @param pos position within the line to place the cursor at (integer)
4419 """ 4421 """
4424 4426
4425 if newWin: 4427 if newWin:
4426 self._modificationStatusChanged(editor.isModified(), editor) 4428 self._modificationStatusChanged(editor.isModified(), editor)
4427 self._checkActions(editor) 4429 self._checkActions(editor)
4428 4430
4429 if lineno >= 0: 4431 cline, cindex = editor.getCursorPosition()
4430 editor.ensureVisibleTop(lineno) 4432 cline += 1
4431 editor.gotoLine(lineno, pos) 4433 if isinstance(lineno, list):
4434 if len(lineno) > 1:
4435 for line in lineno:
4436 if line > cline:
4437 break
4438 else:
4439 line = lineno[0]
4440 elif len(lineno) == 1:
4441 line = lineno[0]
4442 else:
4443 line = -1
4444 else:
4445 line = lineno
4446
4447 if line >= 0 and line != cline:
4448 editor.ensureVisibleTop(line)
4449 editor.gotoLine(line, pos)
4432 4450
4433 if selStart != selEnd: 4451 if selStart != selEnd:
4434 editor.setSelection(lineno - 1, selStart, lineno - 1, selEnd) 4452 editor.setSelection(line - 1, selStart, line - 1, selEnd)
4435 4453
4436 # insert filename into list of recently opened files 4454 # insert filename into list of recently opened files
4437 self.addToRecentList(fn) 4455 self.addToRecentList(fn)
4438 4456
4439 def __connectEditor(self, editor): 4457 def __connectEditor(self, editor):

eric ide

mercurial