mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
Replace BufWidth & BufHeight with BufView
BufView returns not only the buffer's width and height but also its x,y position. It may be useful e.g. for checking if a mouse click was on the actual buffer or ourside it, e.g. on the gutter.
This commit is contained in:
@@ -94,16 +94,18 @@ func (w *BufWindow) IsActive() bool {
|
||||
return w.active
|
||||
}
|
||||
|
||||
// BufWidth returns the width of the actual buffer displayed in the window,
|
||||
// which is usually less than the window width due to the gutter, ruler or scrollbar
|
||||
func (w *BufWindow) BufWidth() int {
|
||||
return w.bufWidth
|
||||
}
|
||||
|
||||
// BufHeight returns the height of the actual buffer displayed in the window,
|
||||
// which is usually less than the window height due to the statusline
|
||||
func (w *BufWindow) BufHeight() int {
|
||||
return w.bufHeight
|
||||
// BufView returns the width, height and x,y location of the actual buffer.
|
||||
// It is not exactly the same as the whole window which also contains gutter,
|
||||
// ruler, scrollbar and statusline.
|
||||
func (w *BufWindow) BufView() View {
|
||||
return View{
|
||||
X: w.gutterOffset,
|
||||
Y: 0,
|
||||
Width: w.bufWidth,
|
||||
Height: w.bufHeight,
|
||||
StartLine: w.StartLine,
|
||||
StartCol: w.StartCol,
|
||||
}
|
||||
}
|
||||
|
||||
func (w *BufWindow) updateDisplayInfo() {
|
||||
|
||||
Reference in New Issue
Block a user